1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: remove check of NULL pointers before calling config_file_option_free() (issue #865)

This commit is contained in:
Sébastien Helleu
2024-04-25 19:26:02 +02:00
parent 561dd92d8e
commit 61ff0b8587
4 changed files with 26 additions and 52 deletions
+6 -12
View File
@@ -456,18 +456,12 @@ proxy_new (const char *name, const char *type, const char *ipv6,
option_username, option_password);
if (!new_proxy)
{
if (option_type)
config_file_option_free (option_type, 0);
if (option_ipv6)
config_file_option_free (option_ipv6, 0);
if (option_address)
config_file_option_free (option_address, 0);
if (option_port)
config_file_option_free (option_port, 0);
if (option_username)
config_file_option_free (option_username, 0);
if (option_password)
config_file_option_free (option_password, 0);
config_file_option_free (option_type, 0);
config_file_option_free (option_ipv6, 0);
config_file_option_free (option_address, 0);
config_file_option_free (option_port, 0);
config_file_option_free (option_username, 0);
config_file_option_free (option_password, 0);
}
return new_proxy;
+3 -6
View File
@@ -480,10 +480,8 @@ error:
}
else
{
if (option_conditions)
config_file_option_free (option_conditions, 0);
if (option_content)
config_file_option_free (option_content, 0);
config_file_option_free (option_conditions, 0);
config_file_option_free (option_content, 0);
}
return NULL;
}
@@ -612,8 +610,7 @@ gui_bar_item_custom_free_data (struct t_gui_bar_item_custom *item)
free (item->name);
for (i = 0; i < GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS; i++)
{
if (item->options[i])
config_file_option_free (item->options[i], 1);
config_file_option_free (item->options[i], 1);
}
}
+15 -30
View File
@@ -1776,34 +1776,20 @@ gui_bar_new (const char *name, const char *hidden, const char *priority,
option_items);
if (!ptr_bar)
{
if (option_hidden)
config_file_option_free (option_hidden, 0);
if (option_priority)
config_file_option_free (option_priority, 0);
if (option_type)
config_file_option_free (option_type, 0);
if (option_conditions)
config_file_option_free (option_conditions, 0);
if (option_position)
config_file_option_free (option_position, 0);
if (option_filling_top_bottom)
config_file_option_free (option_filling_top_bottom, 0);
if (option_filling_left_right)
config_file_option_free (option_filling_left_right, 0);
if (option_size)
config_file_option_free (option_size, 0);
if (option_size_max)
config_file_option_free (option_size_max, 0);
if (option_color_fg)
config_file_option_free (option_color_fg, 0);
if (option_color_delim)
config_file_option_free (option_color_delim, 0);
if (option_color_bg)
config_file_option_free (option_color_bg, 0);
if (option_separator)
config_file_option_free (option_separator, 0);
if (option_items)
config_file_option_free (option_items, 0);
config_file_option_free (option_hidden, 0);
config_file_option_free (option_priority, 0);
config_file_option_free (option_type, 0);
config_file_option_free (option_conditions, 0);
config_file_option_free (option_position, 0);
config_file_option_free (option_filling_top_bottom, 0);
config_file_option_free (option_filling_left_right, 0);
config_file_option_free (option_size, 0);
config_file_option_free (option_size_max, 0);
config_file_option_free (option_color_fg, 0);
config_file_option_free (option_color_delim, 0);
config_file_option_free (option_color_bg, 0);
config_file_option_free (option_separator, 0);
config_file_option_free (option_items, 0);
}
}
@@ -2215,8 +2201,7 @@ gui_bar_free (struct t_gui_bar *bar)
free (bar->name);
for (i = 0; i < GUI_BAR_NUM_OPTIONS; i++)
{
if (bar->options[i])
config_file_option_free (bar->options[i], 1);
config_file_option_free (bar->options[i], 1);
}
gui_bar_free_items_arrays (bar);
+2 -4
View File
@@ -1564,8 +1564,7 @@ error:
gui_key_context_string[context]);
}
free (key_fixed);
if (ptr_option)
config_file_option_free (ptr_option, 0);
config_file_option_free (ptr_option, 0);
return NULL;
}
@@ -2625,8 +2624,7 @@ gui_key_free (int context,
weechat_config_file,
weechat_config_section_key[context],
key->key);
if (ptr_option)
config_file_option_free (ptr_option, 1);
config_file_option_free (ptr_option, 1);
}
/* free memory */