From e5bf0a498b9aecd1df0e2388845d82c406336a49 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 7 Jun 2008 15:46:12 +0200 Subject: Fix crash with config reload and bug with empty key section (no more keys after reload if weechat.conf was deleted) (bug #23514) --- src/core/wee-config.c | 4 ++-- src/plugins/logger/logger.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index de77a7fc1..8642ab33a 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -499,10 +499,10 @@ config_weechat_reload (void *data, struct t_config_file *config_file) /* make C compiler happy */ (void) data; - (void) config_file; /* remove all keys */ gui_keyboard_free_all (&gui_keys, &last_gui_key); + gui_keyboard_default_bindings (); /* remove all bars */ gui_bar_free_all (); @@ -510,7 +510,7 @@ config_weechat_reload (void *data, struct t_config_file *config_file) /* remove all filters */ gui_filter_free_all (); - rc = config_file_reload (weechat_config_file); + rc = config_file_reload (config_file); if (rc == WEECHAT_CONFIG_READ_OK) { diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index c19a63352..5db241256 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -78,7 +78,9 @@ logger_config_read () { long number; char *string, *error; - + + if (logger_option_path) + free (logger_option_path); logger_option_path = weechat_config_get_plugin (LOGGER_OPTION_PATH); if (!logger_option_path) { @@ -86,6 +88,8 @@ logger_config_read () LOGGER_DEFAULT_OPTION_PATH); logger_option_path = weechat_config_get_plugin ("path"); } + if (logger_option_path) + logger_option_path = strdup (logger_option_path); string = weechat_config_get_plugin (LOGGER_OPTION_NAME_LOWER_CASE); if (!string) @@ -98,7 +102,9 @@ logger_config_read () logger_option_name_lower_case = 1; else logger_option_name_lower_case = 0; - + + if (logger_option_time_format) + free (logger_option_time_format); logger_option_time_format = weechat_config_get_plugin (LOGGER_OPTION_TIME_FORMAT); if (!logger_option_time_format) { @@ -106,6 +112,8 @@ logger_config_read () LOGGER_DEFAULT_OPTION_TIME_FORMAT); logger_option_time_format = weechat_config_get_plugin (LOGGER_OPTION_TIME_FORMAT); } + if (logger_option_time_format) + logger_option_time_format = strdup (logger_option_time_format); string = weechat_config_get_plugin (LOGGER_OPTION_INFO_LINES); if (!string) @@ -719,5 +727,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) logger_stop_all (); + if (logger_option_path) + free (logger_option_path); + if (logger_option_time_format) + free (logger_option_time_format); + return WEECHAT_RC_OK; } -- cgit v1.2.3