summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-08-10 15:51:35 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-08-10 15:51:35 +0200
commit93d472e3d0a335ff6be5e288cb0e63e22e19ef13 (patch)
treeef7556b8f0ec52b70875212912d6ebcd48e24a9b /src/core
parente226c2e147348790438390c9712f3ad0068045b5 (diff)
downloadweechat-93d472e3d0a335ff6be5e288cb0e63e22e19ef13.zip
core: fix potential crash in case of malloc error when resetting config option
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-config-file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 7c313ee16..00bc6dbf3 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -979,6 +979,8 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
option->value = malloc (sizeof (int));
if (option->value)
CONFIG_INTEGER(option) = 0;
+ else
+ break;
}
if (CONFIG_INTEGER(option) == CONFIG_INTEGER_DEFAULT(option))
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
@@ -1009,6 +1011,8 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
option->value = malloc (sizeof (int));
if (option->value)
CONFIG_INTEGER(option) = 0;
+ else
+ break;
}
if (CONFIG_COLOR(option) == CONFIG_COLOR_DEFAULT(option))
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;