mirror of
https://github.com/curl/curl.git
synced 2025-01-24 14:15:18 +08:00
tool_operate: avoid fclose(NULL) on bad header dump file
Fixes #10570 Reported-by: Jérémy Rabasco Closes #10571
This commit is contained in:
parent
0cafff2e5f
commit
1c9cfb7af3
@ -984,12 +984,13 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
*/
|
||||
if(!per->prev || per->prev->config != config) {
|
||||
newfile = fopen(config->headerfile, "wb+");
|
||||
fclose(newfile);
|
||||
if(newfile)
|
||||
fclose(newfile);
|
||||
}
|
||||
newfile = fopen(config->headerfile, "ab+");
|
||||
|
||||
if(!newfile) {
|
||||
warnf(global, "Failed to open %s\n", config->headerfile);
|
||||
errorf(global, "Failed to open %s\n", config->headerfile);
|
||||
result = CURLE_WRITE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user