summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-12-11 11:16:12 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-12-11 11:16:34 +0100
commite882eb37b0d1054a51b1d99d7a009a9a311e3df5 (patch)
tree707129b9295c37cd82ca6a201db4029df673b590
parent5a1b0f4c5bcc9c5266b28ecc06e6bd7217276a85 (diff)
downloadcurl-bagder/torture-test58.tar.gz
curl: fixup cleanup in error path when uploadingbagder/torture-test58
Found by torture test 58
-rw-r--r--src/tool_operhlp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c
index 543bf4302..8a9b7c9e8 100644
--- a/src/tool_operhlp.c
+++ b/src/tool_operhlp.c
@@ -115,16 +115,17 @@ char *add_file_name_to_url(char *url, const char *filename)
urlbuffer = aprintf("%s/%s", url, encfile);
curl_free(encfile);
- Curl_safefree(url);
- if(!urlbuffer)
- return NULL;
+ if(!urlbuffer) {
+ url = NULL;
+ goto end;
+ }
+ Curl_safefree(url);
url = urlbuffer; /* use our new URL instead! */
}
- else
- Curl_safefree(url);
}
+ end:
curl_easy_cleanup(curl);
return url;
}