]> granicus.if.org Git - curl/commitdiff
cleanup better when connects fail
authorDaniel Stenberg <daniel@haxx.se>
Wed, 28 Feb 2001 14:03:46 +0000 (14:03 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 28 Feb 2001 14:03:46 +0000 (14:03 +0000)
lib/url.c

index 904e90bf3d5f2baa8d246257f7a1e4e1c037104d..c6ee3121c618ef33bcd209cc96c813a301396d38 100644 (file)
--- 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;
 }