mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 16:48:49 -05:00
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:
parent
271ec6b9b6
commit
392bff4abf
@ -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;
|
||||
|
@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# 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
|
||||
@ -146,7 +146,7 @@ test1260 test1261 test1262 test1263 test1264 test1265 test1266 test1267 \
|
||||
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 \
|
||||
|
67
tests/data/test1293
Normal file
67
tests/data/test1293
Normal file
@ -0,0 +1,67 @@
|
||||
<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
|
||||
Host: 127.0.0.1:8990
|
||||
Accept: */*
|
||||
Content-Length: 126
|
||||
Content-Type: multipart/form-data; boundary=----------------------------
|
||||
|
||||
------------------------------
|
||||
Content-Disposition: form-data
|
||||
|
||||
|
||||
--------------------------------
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
Loading…
Reference in New Issue
Block a user