multi_runsingle: fix memory leak

Coverity CID 1202837. There's a potential risk that 'newurl' gets
overwritten when it was already pointing to allocated memory.
This commit is contained in:
Daniel Stenberg 2014-10-02 23:22:01 +02:00
parent ea6c5f03a5
commit 0d357155cc

View 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;