]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi_runsingle: fix memory leak
authorDaniel Stenberg <daniel@haxx.se>
Thu, 2 Oct 2014 21:22:01 +0000 (23:22 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 2 Oct 2014 21:22:01 +0000 (23:22 +0200)
Coverity CID 1202837. There's a potential risk that 'newurl' gets
overwritten when it was already pointing to allocated memory.

lib/multi.c

index a1dc2c82c97d67594fd55bbab5bd488db4715e42..7e7da682a9ce300572b3bce9676f1753c6f7626e 100644 (file)
@@ -1590,6 +1590,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
           if(!retry) {
             /* if the URL is a follow-location and not just a retried request
                then figure out the URL here */
+            if(newurl)
+              free(newurl);
             newurl = data->req.newurl;
             data->req.newurl = NULL;
             follow = FOLLOW_REDIR;