tool_getparam: fix memory leak on error in parse_ech

- Free tmpcfg memory before returning an error code if aprintf failed.

Closes https://github.com/curl/curl/pull/15753
This commit is contained in:
Hermes Zhang 2024-12-16 12:55:57 +08:00 committed by Jay Satiro
parent 6eb86e428d
commit fc5c9ed253

View 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 {