]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: free resource in error path
authorDaniel Gustafsson <daniel@yesql.se>
Sat, 30 Apr 2022 19:25:15 +0000 (21:25 +0200)
committerDaniel Gustafsson <daniel@yesql.se>
Sat, 30 Apr 2022 19:25:15 +0000 (21:25 +0200)
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>
src/tool_cb_wrt.c

index df132d84c207422ec11a66f722643b1b1eec9ef7..68e17e5d63d42b2ca93ab2c55040cb7462799f24 100644 (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);