]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_paramhlp: free the proto strings on exit
authorDaniel Stenberg <daniel@haxx.se>
Wed, 14 Dec 2022 22:55:37 +0000 (23:55 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 15 Dec 2022 07:28:38 +0000 (08:28 +0100)
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
src/tool_paramhlp.c

index 21c0cc19cd711c991c09694f273f404cc0c0c8eb..4702045739e507d64da911163daf07ad96e737f8 100644 (file)
@@ -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) {
index ae9fb1377a4d92297217b9fbf3baf0eedc6bc9d0..c4fd0a192e85fbf9117ea59b14fd360af7bc4e37 100644 (file)
@@ -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;