From: Daniel Stenberg Date: Wed, 14 Dec 2022 22:55:37 +0000 (+0100) Subject: tool_paramhlp: free the proto strings on exit X-Git-Tag: curl-7_87_0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=614f78131ad7db715ab8279f4a8af9bf0b2b4789;p=thirdparty%2Fcurl.git tool_paramhlp: free the proto strings on exit And also make sure that repeated use of the options free the previous string before it stores a new. Follow-up from e6f8445edef8e7996d Closes #10098 --- diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index 21c0cc19cd..4702045739 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -90,6 +90,8 @@ static void free_config_fields(struct OperationConfig *config) Curl_safefree(config->netrc_file); Curl_safefree(config->output_dir); + Curl_safefree(config->proto_str); + Curl_safefree(config->proto_redir_str); urlnode = config->url_list; while(urlnode) { diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index ae9fb1377a..c4fd0a192e 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -433,6 +433,7 @@ ParameterError proto2num(struct OperationConfig *config, result = curlx_dyn_addf(&obuf, "%s,", protoset[proto]); free((char *) protoset); curlx_dyn_setlen(&obuf, curlx_dyn_len(&obuf) - 1); + free(*ostr); *ostr = curlx_dyn_ptr(&obuf); return *ostr ? PARAM_OK : PARAM_NO_MEM;