]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: fix memory leak on error in parse_ech
authorHermes Zhang <chenhuiz@axis.com>
Mon, 16 Dec 2024 04:55:57 +0000 (12:55 +0800)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 16 Dec 2024 05:56:11 +0000 (00:56 -0500)
- Free tmpcfg memory before returning an error code if aprintf failed.

Closes https://github.com/curl/curl/pull/15753

src/tool_getparam.c

index 0a41ea79b7df5c987ab1044630cbb5bfa301ea48..9fb729086bed33f6ae0c374867e4ba49883e27b3 100644 (file)
@@ -1169,9 +1169,9 @@ static ParameterError parse_ech(struct GlobalConfig *global,
       if(err)
         return err;
       config->ech_config = aprintf("ecl:%s",tmpcfg);
+      free(tmpcfg);
       if(!config->ech_config)
         return PARAM_NO_MEM;
-      free(tmpcfg);
     } /* file done */
   }
   else {