summaryrefslogtreecommitdiff
path: root/src/tool_operate.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-01-04 21:40:49 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-01-04 23:06:44 +0100
commit392bff4abf6b177d0770bcb26e43ae5d7addd7c9 (patch)
tree1230a1dd2627b6f6389cf8caf2d33a9360df9176 /src/tool_operate.c
parent271ec6b9b6276499b9e45083611e1d08d951b59a (diff)
downloadcurl-392bff4abf6b177d0770bcb26e43ae5d7addd7c9.tar.gz
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
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r--src/tool_operate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 9dc59b2e9..2bee9349a 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -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;