From 614f78131ad7db715ab8279f4a8af9bf0b2b4789 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 14 Dec 2022 23:55:37 +0100 Subject: [PATCH] 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 --- src/tool_cfgable.c | 2 ++ src/tool_paramhlp.c | 1 + 2 files changed, 3 insertions(+) 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;