]> jfr.im git - irc/weechat/weechat.git/commitdiff
core: fix memory leak when config version is invalid or not supported
authorSébastien Helleu <redacted>
Mon, 30 Oct 2023 11:25:28 +0000 (12:25 +0100)
committerSébastien Helleu <redacted>
Mon, 30 Oct 2023 22:30:01 +0000 (23:30 +0100)
ChangeLog.adoc
src/core/wee-config-file.c

index 56415b646835b2ac222695019b4e06c4564b3c71..b9f6daa2a84fff202c24ce9d543d5d33f8cd1c0d 100644 (file)
@@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele
 
 Bug fixes::
 
+  * core: fix memory leak when config version is invalid or not supported
   * core: fix crash when "config_version" is present in a configuration file without a value
   * core: display an error on startup if environment variable "HOME" is not set
   * ruby: fix use of NULL variable when displaying exception
index 83fef3b76093108a627a3e7f1ffc076aed77ff63..59551fff25f6018b246617fa276d33bd4f1aa2a0 100644 (file)
@@ -3670,6 +3670,10 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
                     filename, line_number,
                     line);
                 config_file_backup (filename);
+                if (option)
+                    free (option);
+                if (value)
+                    free (value);
                 goto end_file;
             }
             else
@@ -3687,6 +3691,10 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
                         config_file->version_read,
                         config_file->version);
                     config_file_backup (filename);
+                    if (option)
+                        free (option);
+                    if (value)
+                        free (value);
                     goto end_file;
                 }
             }