diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 19:09:11 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 08:53:22 +0200 |
commit | 3057d846d97a4b4bcab4c94b52d83b19bb9abcab (patch) | |
tree | 0aea1670a35b93dd3830cfc9ad4ced7faa2de603 /src/gui | |
parent | 9a5a1fb300d30630f62cb4707ee6be6937f3467e (diff) | |
download | weechat-3057d846d97a4b4bcab4c94b52d83b19bb9abcab.zip |
core: remove check of NULL pointers before calling string_free_split() (issue #865)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-bar-window.c | 3 | ||||
-rw-r--r-- | src/gui/gui-bar-window.c | 3 | ||||
-rw-r--r-- | src/gui/gui-bar.c | 3 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 12 | ||||
-rw-r--r-- | src/gui/gui-color.c | 3 | ||||
-rw-r--r-- | src/gui/gui-filter.c | 3 | ||||
-rw-r--r-- | src/gui/gui-key.c | 9 | ||||
-rw-r--r-- | src/gui/gui-nick.c | 3 |
8 files changed, 13 insertions, 26 deletions
diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 0b02b6951..4e1fcf3c8 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -877,8 +877,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, } } } - if (items) - string_free_split (items); + string_free_split (items); free (content); } else diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index f2b0e3750..89196ee21 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -965,8 +965,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window, { for (sub = 0; sub < bar_window->items_subcount[i]; sub++) { - if (split_items[i][sub]) - string_free_split (split_items[i][sub]); + string_free_split (split_items[i][sub]); } free (split_items[i]); } diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 456b8bdce..f8104ca9a 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -684,8 +684,7 @@ gui_bar_free_items_arrays (struct t_gui_bar *bar) for (i = 0; i < bar->items_count; i++) { - if (bar->items_array[i]) - string_free_split (bar->items_array[i]); + string_free_split (bar->items_array[i]); for (j = 0; j < bar->items_subcount[i]; j++) { free (bar->items_buffer[i][j]); diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 14c0b910d..cb36e02ff 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1908,10 +1908,8 @@ gui_buffer_add_highlight_words (struct t_gui_buffer *buffer, weelist_free (list); - if (current_words) - string_free_split (current_words); - if (add_words) - string_free_split (add_words); + string_free_split (current_words); + string_free_split (add_words); } /* @@ -1964,10 +1962,8 @@ gui_buffer_remove_highlight_words (struct t_gui_buffer *buffer, weelist_free (list); - if (current_words) - string_free_split (current_words); - if (remove_words) - string_free_split (remove_words); + string_free_split (current_words); + string_free_split (remove_words); } /* diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index 1411f8a37..689270628 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -1183,8 +1183,7 @@ gui_color_decode_ansi_cb (void *data, const char *text) } end: - if (items) - string_free_split (items); + string_free_split (items); free (text2); return (output) ? output : strdup (""); diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index 5ec2051e2..c7caadc8d 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -540,8 +540,7 @@ gui_filter_free (struct t_gui_filter *filter) /* free data */ free (filter->name); free (filter->buffer_name); - if (filter->buffers) - string_free_split (filter->buffers); + string_free_split (filter->buffers); free (filter->tags); if (filter->tags_array) string_free_split_tags (filter->tags_array); diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 10f2f378d..a153ba99a 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -2494,10 +2494,8 @@ gui_key_pressed (const char *key_str) break; } - if (chunks1) - string_free_split (chunks1); - if (chunks2) - string_free_split (chunks2); + string_free_split (chunks1); + string_free_split (chunks2); if (ptr_key) { @@ -2635,8 +2633,7 @@ gui_key_free (int context, /* free memory */ free (key->key); - if (key->chunks) - string_free_split (key->chunks); + string_free_split (key->chunks); for (i = 0; i < 2; i++) { free (key->area_name[i]); diff --git a/src/gui/gui-nick.c b/src/gui/gui-nick.c index f278904c9..5c71f26bf 100644 --- a/src/gui/gui-nick.c +++ b/src/gui/gui-nick.c @@ -324,8 +324,7 @@ gui_nick_find_color_name (const char *nickname, int case_range, end: result = strdup ((ptr_result) ? ptr_result : default_color); - if (list_colors) - string_free_split (list_colors); + string_free_split (list_colors); free (nickname2); free (nickname3); return result; |