From 3a245686caa30294a6b5cfefa78ee92513c56daa Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 14 Aug 2012 11:53:53 +0200 Subject: [PATCH] core: free some variables used for weechat.conf when quitting WeeChat --- src/core/wee-config.c | 31 +++++++++++++++++++++++++++++++ src/core/wee-config.h | 1 + src/core/weechat.c | 1 + 3 files changed, 33 insertions(+) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 502af8c99..fedbc0f66 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -3021,3 +3021,34 @@ config_weechat_write () { return config_file_write (weechat_config_file); } + +/* + * config_weechat_free: free WeeChat configuration file and vars + */ + +void +config_weechat_free () +{ + config_file_free (weechat_config_file); + + if (config_highlight_regex) + { + regfree (config_highlight_regex); + free (config_highlight_regex); + config_highlight_regex = NULL; + } + + if (config_highlight_tags) + { + string_free_split (config_highlight_tags); + config_highlight_tags = NULL; + config_num_highlight_tags = 0; + } + + if (config_plugin_extensions) + { + string_free_split (config_plugin_extensions); + config_plugin_extensions = NULL; + config_num_plugin_extensions = 0; + } +} diff --git a/src/core/wee-config.h b/src/core/wee-config.h index efb399b99..b45283cc1 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -279,5 +279,6 @@ extern int config_weechat_notify_set (struct t_gui_buffer *buffer, extern int config_weechat_init (); extern int config_weechat_read (); extern int config_weechat_write (); +extern void config_weechat_free (); #endif /* __WEECHAT_CONFIG_H */ diff --git a/src/core/weechat.c b/src/core/weechat.c index 4fd049de4..5b25a2177 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -521,6 +521,7 @@ main (int argc, char *argv[]) (void) config_weechat_write (NULL); /* save WeeChat config file */ gui_main_end (1); /* shut down WeeChat GUI */ proxy_free_all (); /* free all proxies */ + config_weechat_free (); /* free weechat.conf and vars */ config_file_free_all (); /* free all configuration files */ gui_key_end (); /* remove all keys */ unhook_all (); /* remove all hooks */