mirror of
https://github.com/curl/curl.git
synced 2026-06-19 04:35:37 +03: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
1 changed files with 3 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue