]> granicus.if.org Git - curl/commitdiff
proxy: fixed a memory leak on OOM
authorDan Fandrich <dan@coneharvesters.com>
Sat, 25 Feb 2017 20:36:39 +0000 (21:36 +0100)
committerDan Fandrich <dan@coneharvesters.com>
Sat, 25 Feb 2017 20:36:39 +0000 (21:36 +0100)
lib/url.c

index 38b9552f7a9de03c06652f1188a9516c2412bda8..b2dac8bcbdbc24abb06b8e1ee76fdad265cbb5a9 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -5118,15 +5118,19 @@ static CURLcode parse_proxy(struct Curl_easy *data,
          with reserved characters like ':' in them. */
       Curl_safefree(proxyinfo->user);
       proxyinfo->user = curl_easy_unescape(data, proxyuser, 0, NULL);
+      Curl_safefree(proxyuser);
 
-      if(!proxyinfo->user)
+      if(!proxyinfo->user) {
+        Curl_safefree(proxypasswd);
         return CURLE_OUT_OF_MEMORY;
+      }
 
       Curl_safefree(proxyinfo->passwd);
       if(proxypasswd && strlen(proxypasswd) < MAX_CURL_PASSWORD_LENGTH)
         proxyinfo->passwd = curl_easy_unescape(data, proxypasswd, 0, NULL);
       else
         proxyinfo->passwd = strdup("");
+      Curl_safefree(proxypasswd);
 
       if(!proxyinfo->passwd)
         return CURLE_OUT_OF_MEMORY;