From 622cf7db6bd2d943e67660020b3984e6068f1084 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 10 Oct 2019 11:18:21 +0200 Subject: socketpair: fix double-close in error case Follow-up to bc2dbef0afc08 --- lib/socketpair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/socketpair.c b/lib/socketpair.c index 5dd9f27e9..ffdfdad7f 100644 --- a/lib/socketpair.c +++ b/lib/socketpair.c @@ -89,8 +89,6 @@ int Curl_socketpair(int domain, int type, int protocol, if(socks[1] == CURL_SOCKET_BAD) goto error; - sclose(listener); - /* verify that nothing else connected */ msnprintf(data[0], sizeof(data[0]), "%p", socks); dlen = strlen(data[0]); @@ -100,6 +98,8 @@ int Curl_socketpair(int domain, int type, int protocol, goto error; if(memcmp(data[0], data[1], dlen)) goto error; + + sclose(listener); return 0; error: -- cgit v1.2.3