1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 16:45:06 -05:00

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
This commit is contained in:
Daniel Stenberg 2018-11-30 11:59:04 +01:00
parent 8e2549b86c
commit 650281ed5b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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);