1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

core: fix potential crash in case of malloc error when resetting config option

This commit is contained in:
Sébastien Helleu
2014-08-10 15:51:35 +02:00
parent e226c2e147
commit 93d472e3d0
+4
View File
@@ -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;