summaryrefslogtreecommitdiff
path: root/src/tool_operhlp.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-10-05 16:41:04 +0200
committerYang Tse <yangsita@gmail.com>2011-10-05 16:41:04 +0200
commitec73fd89ed5b526548e61527037e1603234333a0 (patch)
tree2d3be4893b383eb5f7b3c4bd37379190dc95812f /src/tool_operhlp.c
parent5bf0d74120a92fb834b0d13098c0b5e93249a84f (diff)
downloadcurl-ec73fd89ed5b526548e61527037e1603234333a0.tar.gz
curl tool: OOM handling fixes
Diffstat (limited to 'src/tool_operhlp.c')
-rw-r--r--src/tool_operhlp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c
index 5a6a670f9..d7dbe13c1 100644
--- a/src/tool_operhlp.c
+++ b/src/tool_operhlp.c
@@ -132,6 +132,7 @@ char *add_file_name_to_url(CURL *curl, char *url, const char *filename)
if(encfile) {
char *urlbuffer = malloc(strlen(url) + strlen(encfile) + 3);
if(!urlbuffer) {
+ curl_free(encfile);
Curl_safefree(url);
return NULL;
}
@@ -143,8 +144,8 @@ char *add_file_name_to_url(CURL *curl, char *url, const char *filename)
sprintf(urlbuffer, "%s/%s", url, encfile);
curl_free(encfile);
-
Curl_safefree(url);
+
url = urlbuffer; /* use our new URL instead! */
}
}