aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hostip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index e0bfe5b17..32bb03de3 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -1531,12 +1531,15 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
}
else
rc = CURLE_OPERATION_TIMEDOUT;
+ }
- destroy_thread_data(&conn->async);
+ destroy_thread_data(&conn->async);
+
+ if (CURLE_OK != rc)
/* close the connection, since we can't return failure here without
cleaning up this connection properly */
Curl_disconnect(conn);
- }
+
return (rc);
}