mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 17:31:46 -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:
parent
8e2549b86c
commit
650281ed5b
@ -2066,6 +2066,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||||||
fname = nextarg;
|
fname = nextarg;
|
||||||
file = fopen(nextarg, FOPEN_READTEXT);
|
file = fopen(nextarg, FOPEN_READTEXT);
|
||||||
}
|
}
|
||||||
|
Curl_safefree(config->writeout);
|
||||||
err = file2string(&config->writeout, file);
|
err = file2string(&config->writeout, file);
|
||||||
if(file && (file != stdin))
|
if(file && (file != stdin))
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user