From 9bc24e48768a25f308f8992ea4a671657279a9df Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 28 Feb 2001 14:03:46 +0000 Subject: cleanup better when connects fail --- lib/url.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/url.c b/lib/url.c index 904e90bf3..c6ee3121c 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1737,7 +1737,12 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect) if(CURLE_OK != code) { /* We're not allowed to return failure with memory left allocated in the connectdata struct, free those here */ + struct UrlData *data; + int index; + conn = (struct connectdata *)*in_connect; + data = conn->data; +#if 0 if(conn) { if(conn->path) free(conn->path); @@ -1751,6 +1756,11 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect) free(conn); *in_connect=NULL; } +#endif + index = conn->connectindex; /* get the index */ + curl_disconnect(conn); /* close the connection */ + data->connects[index]=NULL; /* clear the pointer */ + } return code; } -- cgit v1.2.3