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

plugins: remove check of NULL pointers before calling weechat_arraylist_free() (issue #865)

This commit is contained in:
Sébastien Helleu
2024-04-25 00:19:31 +02:00
parent e73bff95fa
commit 3eed74a75c
6 changed files with 8 additions and 10 deletions
+1 -2
View File
@@ -372,8 +372,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
snprintf (str_format_number_empty, sizeof (str_format_number_empty),
"%%-%ds", length_max_number);
if (buflist_list_buffers[item_index])
weechat_arraylist_free (buflist_list_buffers[item_index]);
weechat_arraylist_free (buflist_list_buffers[item_index]);
buflist_list_buffers[item_index] = weechat_arraylist_new (
16, 0, 1,
NULL, NULL, NULL, NULL);
+1 -2
View File
@@ -567,8 +567,7 @@ fset_command_run_set_cb (const void *pointer, void *data,
/* check condition to trigger the fset buffer */
if (condition_ok)
{
if (old_options)
weechat_arraylist_free (old_options);
weechat_arraylist_free (old_options);
free (old_max_length);
free (old_filter);
+1 -2
View File
@@ -495,8 +495,7 @@ end:
free (dup_ctcp);
free (dup_ctcp_upper);
free (dup_args);
if (list_messages)
weechat_arraylist_free (list_messages);
weechat_arraylist_free (list_messages);
}
/*
+1 -2
View File
@@ -243,8 +243,7 @@ logger_backlog_group_messages (struct t_arraylist *lines)
error:
free (message);
if (messages)
weechat_arraylist_free (messages);
weechat_arraylist_free (messages);
return NULL;
}
+1 -2
View File
@@ -233,8 +233,7 @@ logger_tail_file (const char *filename, int lines)
error:
free (part_of_line);
if (list_lines)
weechat_arraylist_free (list_lines);
weechat_arraylist_free (list_lines);
if (fd >= 0)
close (fd);
return NULL;
+3
View File
@@ -481,6 +481,9 @@ TEST(CoreArraylist, New)
{
int initial_size, sorted, allow_duplicates;
/* free arraylist with NULL pointer */
arraylist_free (NULL);
/*
* in order to create an arraylist, initial_size must be >= 0 and a
* comparison callback must be given