summaryrefslogtreecommitdiff
path: root/lib/formdata.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2014-02-08 11:33:43 +0100
committerDan Fandrich <dan@coneharvesters.com>2014-02-08 11:33:43 +0100
commit85a4df8b793d1bc53e23368ce06a6c2f141a1bbf (patch)
treef6b4140d5e992f44105d860d63136317b2f1d4a1 /lib/formdata.c
parente2dae8a7c2c417e70262b23d4c1924a43a9d56e1 (diff)
downloadcurl-85a4df8b793d1bc53e23368ce06a6c2f141a1bbf.tar.gz
formdata: Fixed memory leak on OOM condition
Diffstat (limited to 'lib/formdata.c')
-rw-r--r--lib/formdata.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index bdca3e770..e307a28a5 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -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) {