From: Daniel Gustafsson Date: Sat, 30 Apr 2022 19:25:15 +0000 (+0200) Subject: curl: free resource in error path X-Git-Tag: curl-7_83_1~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a7b29122cb35051b65780f37fe2dcaed4f31386b;p=thirdparty%2Fcurl.git 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 --- diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index df132d84c2..68e17e5d63 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -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);