From a7b29122cb35051b65780f37fe2dcaed4f31386b Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Sat, 30 Apr 2022 21:25:15 +0200 Subject: [PATCH] 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 --- src/tool_cb_wrt.c | 1 + 1 file changed, 1 insertion(+) 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); -- 2.47.3