mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
curl: free resource in error path
If the new filename cannot be generated due to memory pressure, free the allocated aname on the way out to avoid a small leak. Closes: #8770 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
This commit is contained in:
parent
6d86193377
commit
a7b29122cb
@ -99,6 +99,7 @@ bool tool_create_output_file(struct OutStruct *outs,
|
||||
newname = malloc(newlen);
|
||||
if(!newname) {
|
||||
errorf(global, "out of memory\n");
|
||||
free(aname);
|
||||
return FALSE;
|
||||
}
|
||||
memcpy(newname, fname, len);
|
||||
|
Loading…
Reference in New Issue
Block a user