1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

formdata: Fixed memory leak on OOM condition

This commit is contained in:
Dan Fandrich 2014-02-08 11:33:43 +01:00
parent e2dae8a7c2
commit 85a4df8b79

View File

@ -1110,8 +1110,10 @@ static CURLcode formdata_add_filename(const struct curl_httppost *file,
/* filename need be escaped */ /* filename need be escaped */
filename_escaped = malloc(strlen(filename)*2+1); filename_escaped = malloc(strlen(filename)*2+1);
if(!filename_escaped) if(!filename_escaped) {
free(filebasename);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
}
p0 = filename_escaped; p0 = filename_escaped;
p1 = filename; p1 = filename;
while(*p1) { while(*p1) {