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 string_free_split() (issue #865)
This commit is contained in:
@@ -3789,8 +3789,7 @@ COMMAND_CALLBACK(item)
|
||||
sargv = string_split_shell (argv_eol[2], &sargc);
|
||||
if (!sargv || (sargc < 3))
|
||||
{
|
||||
if (sargv)
|
||||
string_free_split (sargv);
|
||||
string_free_split (sargv);
|
||||
COMMAND_ERROR;
|
||||
}
|
||||
|
||||
@@ -5147,8 +5146,7 @@ COMMAND_CALLBACK(plugin)
|
||||
full_name = dir_search_full_lib_name (argv[2], "plugins");
|
||||
plugin_load (full_name, 1, plugin_argc, plugin_argv);
|
||||
free (full_name);
|
||||
if (plugin_argv)
|
||||
string_free_split (plugin_argv);
|
||||
string_free_split (plugin_argv);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -5173,8 +5171,7 @@ COMMAND_CALLBACK(plugin)
|
||||
{
|
||||
plugin_reload_name (argv[2], plugin_argc, plugin_argv);
|
||||
}
|
||||
if (plugin_argv)
|
||||
string_free_split (plugin_argv);
|
||||
string_free_split (plugin_argv);
|
||||
}
|
||||
else
|
||||
plugin_reload_name (argv[2], 0, NULL);
|
||||
|
||||
@@ -4014,8 +4014,7 @@ config_file_option_free_data (struct t_config_option *option)
|
||||
free (option->name);
|
||||
free (option->parent_name);
|
||||
free (option->description);
|
||||
if (option->string_values)
|
||||
string_free_split (option->string_values);
|
||||
string_free_split (option->string_values);
|
||||
free (option->default_value);
|
||||
free (option->value);
|
||||
free (option->callback_check_value_data);
|
||||
|
||||
@@ -2930,10 +2930,8 @@ config_weechat_filter_read_cb (const void *pointer, void *data,
|
||||
gui_filter_new ((string_strcasecmp (argv[0], "on") == 0) ? 1 : 0,
|
||||
option_name, argv[1], argv[2], argv_eol[3]);
|
||||
}
|
||||
if (argv)
|
||||
string_free_split (argv);
|
||||
if (argv_eol)
|
||||
string_free_split (argv_eol);
|
||||
string_free_split (argv);
|
||||
string_free_split (argv_eol);
|
||||
}
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
|
||||
+1
-2
@@ -356,8 +356,7 @@ dir_set_home_path (char *path)
|
||||
rc = 1;
|
||||
|
||||
end:
|
||||
if (paths)
|
||||
string_free_split (paths);
|
||||
string_free_split (paths);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -626,11 +626,9 @@ end:
|
||||
free (str_number);
|
||||
free (separators);
|
||||
free (str_flags);
|
||||
if (list_flags)
|
||||
string_free_split (list_flags);
|
||||
string_free_split (list_flags);
|
||||
free (strip_items);
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
return (value) ? value : strdup ("");
|
||||
}
|
||||
|
||||
@@ -726,8 +724,7 @@ eval_string_split_shell (const char *text)
|
||||
|
||||
end:
|
||||
free (str_number);
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
return (value) ? value : strdup ("");
|
||||
}
|
||||
|
||||
|
||||
@@ -224,8 +224,7 @@ end:
|
||||
free (command);
|
||||
free (command_name);
|
||||
|
||||
if (new_commands_allowed)
|
||||
string_free_split (new_commands_allowed);
|
||||
string_free_split (new_commands_allowed);
|
||||
input_commands_allowed = old_commands_allowed;
|
||||
|
||||
return rc;
|
||||
|
||||
@@ -232,8 +232,7 @@ network_load_user_ca_files (int force_display)
|
||||
}
|
||||
|
||||
end:
|
||||
if (paths)
|
||||
string_free_split (paths);
|
||||
string_free_split (paths);
|
||||
hashtable_free (options);
|
||||
|
||||
network_num_certs_user = num_loaded;
|
||||
|
||||
@@ -3044,8 +3044,7 @@ string_split_tags (const char *tags, int *num_tags)
|
||||
tags_array[tags_count] = NULL;
|
||||
}
|
||||
}
|
||||
if (tags_array_temp)
|
||||
string_free_split (tags_array_temp);
|
||||
string_free_split (tags_array_temp);
|
||||
}
|
||||
|
||||
if (num_tags)
|
||||
|
||||
@@ -403,8 +403,7 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
string_free_split (argv);
|
||||
string_free_split (argv);
|
||||
}
|
||||
|
||||
/* write object end */
|
||||
|
||||
@@ -655,8 +655,7 @@ util_version_number (const char *version)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
|
||||
return (version_int[0] << 24) | (version_int[1] << 16)
|
||||
| (version_int[2] << 8) | version_int[3];
|
||||
|
||||
@@ -493,8 +493,7 @@ error:
|
||||
arraylist_free (args);
|
||||
if (result)
|
||||
string_dyn_free (result, 1);
|
||||
if (lines)
|
||||
string_free_split (lines);
|
||||
string_free_split (lines);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,8 +361,7 @@ hook_process_child (struct t_hook *hook_process)
|
||||
}
|
||||
|
||||
/* should not be executed if execvp was OK */
|
||||
if (exec_args)
|
||||
string_free_split (exec_args);
|
||||
string_free_split (exec_args);
|
||||
fprintf (stderr, "Error with command '%s'\n",
|
||||
HOOK_PROCESS(hook_process, command));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
+1
-2
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-2
@@ -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 ("");
|
||||
|
||||
@@ -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);
|
||||
|
||||
+3
-6
@@ -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]);
|
||||
|
||||
+1
-2
@@ -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;
|
||||
|
||||
@@ -858,8 +858,7 @@ plugin_api_info_nick_color_cb (const void *pointer, void *data,
|
||||
-1,
|
||||
(num_items >= 2) ? items[1] : NULL);
|
||||
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -888,8 +887,7 @@ plugin_api_info_nick_color_name_cb (const void *pointer, void *data,
|
||||
-1,
|
||||
(num_items >= 2) ? items[1] : NULL);
|
||||
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -928,8 +926,7 @@ plugin_api_info_nick_color_ignore_case_cb (const void *pointer, void *data,
|
||||
case_range,
|
||||
(num_items >= 3) ? items[2] : NULL);
|
||||
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -968,8 +965,7 @@ plugin_api_info_nick_color_name_ignore_case_cb (const void *pointer, void *data,
|
||||
case_range,
|
||||
(num_items >= 3) ? items[2] : NULL);
|
||||
|
||||
if (items)
|
||||
string_free_split (items);
|
||||
string_free_split (items);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1119,8 +1115,7 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
|
||||
return totp;
|
||||
|
||||
error:
|
||||
if (argv)
|
||||
string_free_split (argv);
|
||||
string_free_split (argv);
|
||||
free (totp);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1191,8 +1186,7 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
|
||||
return strdup (value);
|
||||
|
||||
error:
|
||||
if (argv)
|
||||
string_free_split (argv);
|
||||
string_free_split (argv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user