From: Daniel Stenberg Date: Fri, 30 Nov 2018 10:59:04 +0000 (+0100) Subject: curl: fix memory leak reading --writeout from file X-Git-Tag: curl-7_63_0~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=650281ed5ba335d16a932ccba53665551197880f;p=curl 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 --- 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);