aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/url.c b/lib/url.c
index 2840d32e5..5bb34be71 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -816,6 +816,9 @@ CURLcode Curl_disconnect(struct connectdata *conn)
free(conn->hostent_buf);
#endif
+ if(conn->newurl)
+ free(conn->newurl);
+
if(conn->path) /* the URL path part */
free(conn->path);
@@ -2147,8 +2150,10 @@ CURLcode Curl_connect(struct UrlData *data,
/* We're not allowed to return failure with memory left allocated
in the connectdata struct, free those here */
conn = (struct connectdata *)*in_connect;
- if(conn)
+ if(conn) {
Curl_disconnect(conn); /* close the connection */
+ *in_connect = NULL; /* return a NULL */
+ }
}
return code;
}