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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user