mirror of
https://github.com/curl/curl.git
synced 2025-09-16 00:52:42 +03:00
curl: improved cleanup in upload error path
Memory leak found by torture test 58 Closes #4705
This commit is contained in:
parent
5a1b0f4c5b
commit
dc4900eea7
|
@ -115,16 +115,17 @@ char *add_file_name_to_url(char *url, const char *filename)
|
||||||
urlbuffer = aprintf("%s/%s", url, encfile);
|
urlbuffer = aprintf("%s/%s", url, encfile);
|
||||||
|
|
||||||
curl_free(encfile);
|
curl_free(encfile);
|
||||||
|
|
||||||
|
if(!urlbuffer) {
|
||||||
|
url = NULL;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
Curl_safefree(url);
|
Curl_safefree(url);
|
||||||
|
|
||||||
if(!urlbuffer)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
url = urlbuffer; /* use our new URL instead! */
|
url = urlbuffer; /* use our new URL instead! */
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Curl_safefree(url);
|
|
||||||
}
|
}
|
||||||
|
end:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user