... as it could otherwise leak memory when a transfer failed.
Added test 1293 to verify.
Reported-by: Brian Carpenter
Fixes #4781
Closes #4782
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;
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
test1268 test1269 test1270 \
\
test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \
-test1288 test1289 test1290 test1291 test1292 \
+test1288 test1289 test1290 test1291 test1292 test1293 \
test1298 test1299 \
test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
--- /dev/null
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+-F
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data nocheck="yes">
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+-foo-
+</data>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+Multipart formpost to two URLs, the first failing
+ </name>
+ <command>
+http://0 http://%HOSTIP:%HTTPPORT/1293 -F=
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<strippart>
+s/^--------------------------[a-z0-9]*/------------------------------/
+s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+</strippart>
+<protocol>
+POST /1293 HTTP/1.1\r
+Host: 127.0.0.1:8990\r
+Accept: */*\r
+Content-Length: 126\r
+Content-Type: multipart/form-data; boundary=----------------------------\r
+\r
+------------------------------\r
+Content-Disposition: form-data\r
+\r
+\r
+--------------------------------\r
+</protocol>
+</verify>
+</testcase>