summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-11-30 11:59:04 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-30 22:48:09 +0100
commit650281ed5ba335d16a932ccba53665551197880f (patch)
treefa32e63b9fb287b9eec9486325fed01f93eabd90
parent8e2549b86c4022cdad272c265a66c88f06fc3560 (diff)
downloadcurl-650281ed5ba335d16a932ccba53665551197880f.tar.gz
curl: fix memory leak reading --writeout from file
If another string had been set first, the writout function for reading the syntax from file would leak the previously allocated memory. Reported-by: Brian Carpenter Fixes #3322 Closes #3330
-rw-r--r--src/tool_getparam.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index cd21f774c..c0d3a84f2 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -2066,6 +2066,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
fname = nextarg;
file = fopen(nextarg, FOPEN_READTEXT);
}
+ Curl_safefree(config->writeout);
err = file2string(&config->writeout, file);
if(file && (file != stdin))
fclose(file);