summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-10-10 11:18:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-10-10 11:18:21 +0200
commit622cf7db6bd2d943e67660020b3984e6068f1084 (patch)
treea3832c4539f53662a21a52db25a45dd6b6eedf8a
parent1b843bb5ed4f8d20eab1655957237429780dccd4 (diff)
downloadcurl-622cf7db6bd2d943e67660020b3984e6068f1084.tar.gz
socketpair: fix double-close in error case
Follow-up to bc2dbef0afc08
-rw-r--r--lib/socketpair.c4
1 files 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: