curl: properly free mimepost data

... as it could otherwise leak memory when a transfer failed.

Added test 1293 to verify.

Reported-by: Brian Carpenter
Fixes #4781
Closes #4782
This commit is contained in:
Daniel Stenberg 2020-01-04 21:40:49 +01:00
parent 271ec6b9b6
commit 392bff4abf
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 72 additions and 2 deletions

View file

@ -1357,6 +1357,9 @@ static CURLcode single_transfer(struct GlobalConfig *global,
config->postfieldsize);
break;
case HTTPREQ_MIMEPOST:
/* free previous remainders */
curl_mime_free(config->mimepost);
config->mimepost = NULL;
result = tool2curlmime(curl, config->mimeroot, &config->mimepost);
if(result)
break;