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
1 changed files with 3 additions and 1 deletions

View File

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