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:
Daniel Gustafsson 2022-04-30 21:25:15 +02:00
parent 6d86193377
commit a7b29122cb

View File

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