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_string_free_split() (issue #865)
This commit is contained in:
@@ -283,8 +283,7 @@ alias_replace_args (const char *alias_args, const char *user_args)
|
||||
if (pos > start)
|
||||
weechat_string_dyn_concat (result, start, -1);
|
||||
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv);
|
||||
|
||||
return weechat_string_dyn_free (result, 0);
|
||||
}
|
||||
|
||||
@@ -68,10 +68,8 @@ exec_buffer_input_cb (const void *pointer, void *data,
|
||||
if (argv && argv_eol)
|
||||
exec_command_run (buffer, argc, argv, argv_eol, 0);
|
||||
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -63,9 +63,7 @@ exec_config_change_command_default_options (const void *pointer, void *data,
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if (exec_config_cmd_options)
|
||||
weechat_string_free_split (exec_config_cmd_options);
|
||||
|
||||
weechat_string_free_split (exec_config_cmd_options);
|
||||
exec_config_cmd_options = weechat_string_split (
|
||||
weechat_config_string (exec_config_command_default_options),
|
||||
" ",
|
||||
|
||||
@@ -591,9 +591,7 @@ fset_command_run_set_cb (const void *pointer, void *data,
|
||||
}
|
||||
|
||||
end:
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
|
||||
weechat_string_free_split (argv);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,8 +96,7 @@ fset_completion_option_cb (const void *pointer, void *data,
|
||||
completion, words[i], 0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
}
|
||||
if (words)
|
||||
weechat_string_free_split (words);
|
||||
weechat_string_free_split (words);
|
||||
ptr_option = weechat_hdata_move (fset_hdata_config_option,
|
||||
ptr_option, 1);
|
||||
}
|
||||
|
||||
@@ -142,9 +142,7 @@ fset_config_change_auto_refresh_cb (const void *pointer, void *data,
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if (fset_config_auto_refresh)
|
||||
weechat_string_free_split (fset_config_auto_refresh);
|
||||
|
||||
weechat_string_free_split (fset_config_auto_refresh);
|
||||
fset_config_auto_refresh = weechat_string_split (
|
||||
weechat_config_string (fset_config_look_auto_refresh),
|
||||
",",
|
||||
@@ -206,9 +204,7 @@ fset_config_change_sort_cb (const void *pointer, void *data,
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if (fset_config_sort_fields)
|
||||
weechat_string_free_split (fset_config_sort_fields);
|
||||
|
||||
weechat_string_free_split (fset_config_sort_fields);
|
||||
fset_config_sort_fields = weechat_string_split (
|
||||
weechat_config_string (fset_config_look_sort),
|
||||
",",
|
||||
|
||||
@@ -456,8 +456,7 @@ irc_batch_process_multiline (struct t_irc_server *server,
|
||||
|
||||
end:
|
||||
weechat_hashtable_free (hash_tags);
|
||||
if (list_messages)
|
||||
weechat_string_free_split (list_messages);
|
||||
weechat_string_free_split (list_messages);
|
||||
|
||||
return weechat_string_dyn_free (result, 0);
|
||||
}
|
||||
@@ -500,8 +499,7 @@ irc_batch_modifier_cb (const void *pointer, void *data,
|
||||
result = irc_batch_process_multiline (ptr_server, string, items[2]);
|
||||
}
|
||||
}
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
|
||||
return (result) ? result : strdup (string);
|
||||
}
|
||||
|
||||
@@ -919,8 +919,7 @@ irc_color_decode_ansi_cb (void *data, const char *text)
|
||||
}
|
||||
|
||||
end:
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
free (text2);
|
||||
|
||||
return (output) ? output : strdup ("");
|
||||
|
||||
@@ -705,8 +705,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
|
||||
irc_command_exec_buffers (list_buffers, command);
|
||||
|
||||
weechat_list_free (list_buffers);
|
||||
if (channels)
|
||||
weechat_string_free_split (channels);
|
||||
weechat_string_free_split (channels);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -931,8 +930,7 @@ irc_command_exec_all_servers (int inclusive, const char *str_servers, const char
|
||||
irc_command_exec_buffers (list_buffers, command);
|
||||
|
||||
weechat_list_free (list_buffers);
|
||||
if (servers)
|
||||
weechat_string_free_split (servers);
|
||||
weechat_string_free_split (servers);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1465,10 +1463,8 @@ irc_command_run_away (const void *pointer, void *data,
|
||||
irc_command_away (pointer, data, buffer, argc, argv, argv_eol);
|
||||
}
|
||||
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -3002,8 +2998,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
|
||||
weechat_string_free_split (channels);
|
||||
}
|
||||
|
||||
if (keys)
|
||||
weechat_string_free_split (keys);
|
||||
weechat_string_free_split (keys);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1219,12 +1219,9 @@ irc_config_check_autojoin (const char *autojoin)
|
||||
|
||||
end:
|
||||
free (string);
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
if (channels)
|
||||
weechat_string_free_split (channels);
|
||||
if (keys)
|
||||
weechat_string_free_split (keys);
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (channels);
|
||||
weechat_string_free_split (keys);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -1773,10 +1770,8 @@ irc_config_ignore_read_cb (const void *pointer, void *data,
|
||||
{
|
||||
irc_ignore_new (argv_eol[2], argv[0], argv[1]);
|
||||
}
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -374,12 +374,9 @@ irc_join_split (struct t_irc_server *server, const char *join,
|
||||
}
|
||||
|
||||
end:
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
if (channels)
|
||||
weechat_string_free_split (channels);
|
||||
if (keys)
|
||||
weechat_string_free_split (keys);
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (channels);
|
||||
weechat_string_free_split (keys);
|
||||
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
@@ -448,8 +448,7 @@ irc_list_parse_messages (struct t_irc_server *server, const char *output)
|
||||
}
|
||||
}
|
||||
free (command);
|
||||
if (params)
|
||||
weechat_string_free_split (params);
|
||||
weechat_string_free_split (params);
|
||||
}
|
||||
|
||||
weechat_string_free_split (irc_msgs);
|
||||
|
||||
@@ -520,8 +520,7 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
|
||||
free (channel);
|
||||
free (arguments);
|
||||
free (text);
|
||||
if (params)
|
||||
weechat_string_free_split (params);
|
||||
weechat_string_free_split (params);
|
||||
|
||||
return hashtable;
|
||||
}
|
||||
@@ -1282,10 +1281,8 @@ irc_message_split_join (struct t_irc_message_split_context *context,
|
||||
msg_to_send + length_no_channel + 1);
|
||||
}
|
||||
|
||||
if (channels)
|
||||
weechat_string_free_split (channels);
|
||||
if (keys)
|
||||
weechat_string_free_split (keys);
|
||||
weechat_string_free_split (channels);
|
||||
weechat_string_free_split (keys);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1828,10 +1825,8 @@ end:
|
||||
}
|
||||
|
||||
free (tags);
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
|
||||
return split_context.hashtable;
|
||||
}
|
||||
|
||||
@@ -315,8 +315,7 @@ end:
|
||||
free (new_modes);
|
||||
free (new_args);
|
||||
free (str_modes);
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv);
|
||||
if (channel->modes && (strcmp (channel->modes, "+") == 0))
|
||||
{
|
||||
free (channel->modes);
|
||||
@@ -562,8 +561,7 @@ irc_mode_channel_set (struct t_irc_server *server,
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv);
|
||||
|
||||
if (channel_modes_updated)
|
||||
weechat_bar_item_update ("buffer_modes");
|
||||
|
||||
@@ -6291,8 +6291,7 @@ IRC_PROTOCOL_CALLBACK(353)
|
||||
free (str_params);
|
||||
if (str_nicks)
|
||||
weechat_string_dyn_free (str_nicks, 1);
|
||||
if (nicks)
|
||||
weechat_string_free_split (nicks);
|
||||
weechat_string_free_split (nicks);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -923,9 +923,7 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
|
||||
}
|
||||
|
||||
end:
|
||||
if (arguments_argv)
|
||||
weechat_string_free_split (arguments_argv);
|
||||
|
||||
weechat_string_free_split (arguments_argv);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,8 +431,7 @@ end:
|
||||
free (username);
|
||||
free (username2);
|
||||
free (data);
|
||||
if (attrs)
|
||||
weechat_string_free_split (attrs);
|
||||
weechat_string_free_split (attrs);
|
||||
free (nonce_server);
|
||||
free (salt_base64);
|
||||
free (salt);
|
||||
|
||||
@@ -2289,8 +2289,7 @@ irc_server_free_data (struct t_irc_server *server)
|
||||
}
|
||||
free (server->name);
|
||||
free (server->addresses_eval);
|
||||
if (server->addresses_array)
|
||||
weechat_string_free_split (server->addresses_array);
|
||||
weechat_string_free_split (server->addresses_array);
|
||||
free (server->ports_array);
|
||||
free (server->retry_array);
|
||||
free (server->current_address);
|
||||
@@ -2302,8 +2301,7 @@ irc_server_free_data (struct t_irc_server *server)
|
||||
weechat_unhook (server->hook_timer_anti_flood);
|
||||
irc_server_free_sasl_data (server);
|
||||
free (server->unterminated_message);
|
||||
if (server->nicks_array)
|
||||
weechat_string_free_split (server->nicks_array);
|
||||
weechat_string_free_split (server->nicks_array);
|
||||
free (server->nick);
|
||||
free (server->nick_modes);
|
||||
free (server->host);
|
||||
@@ -2315,8 +2313,7 @@ irc_server_free_data (struct t_irc_server *server)
|
||||
free (server->chantypes);
|
||||
free (server->chanmodes);
|
||||
free (server->clienttagdeny);
|
||||
if (server->clienttagdeny_array)
|
||||
weechat_string_free_split (server->clienttagdeny_array);
|
||||
weechat_string_free_split (server->clienttagdeny_array);
|
||||
free (server->away_message);
|
||||
if (server->cmd_list_regexp)
|
||||
{
|
||||
|
||||
@@ -72,8 +72,7 @@ plugin_script_api_string_match_list (struct t_weechat_plugin *weechat_plugin,
|
||||
(const char **)list_masks,
|
||||
case_sensitive);
|
||||
|
||||
if (list_masks)
|
||||
weechat_string_free_split (list_masks);
|
||||
weechat_string_free_split (list_masks);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -166,8 +166,7 @@ relay_auth_parse_sha (const char *parameters,
|
||||
if (!argv || (argc < 2))
|
||||
{
|
||||
/* not enough parameters */
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -240,8 +239,7 @@ relay_auth_parse_pbkdf2 (const char *parameters,
|
||||
if (!argv || (argc < 3))
|
||||
{
|
||||
/* not enough parameters */
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -321,8 +321,7 @@ relay_http_parse_path (const char *path,
|
||||
|
||||
free (str_path);
|
||||
free (str_params);
|
||||
if (items_path)
|
||||
weechat_string_free_split (items_path);
|
||||
weechat_string_free_split (items_path);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -378,8 +377,7 @@ relay_http_parse_method_path (struct t_relay_http_request *request,
|
||||
return 1;
|
||||
|
||||
error:
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
request->status = RELAY_HTTP_END;
|
||||
return 0;
|
||||
}
|
||||
@@ -1335,8 +1333,7 @@ relay_http_request_free (struct t_relay_http_request *request)
|
||||
weechat_string_dyn_free (request->raw, 1);
|
||||
free (request->method);
|
||||
free (request->path);
|
||||
if (request->path_items)
|
||||
weechat_string_free_split (request->path_items);
|
||||
weechat_string_free_split (request->path_items);
|
||||
weechat_hashtable_free (request->params);
|
||||
free (request->http_version);
|
||||
weechat_hashtable_free (request->headers);
|
||||
|
||||
@@ -106,8 +106,7 @@ relay_info_info_relay_client_count_cb (const void *pointer, void *data,
|
||||
ptr_count = str_count;
|
||||
|
||||
end:
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
|
||||
return (ptr_count) ? strdup (ptr_count) : NULL;
|
||||
}
|
||||
|
||||
@@ -361,12 +361,10 @@ relay_websocket_parse_extensions (const char *extensions,
|
||||
ws_deflate->window_bits_inflate = (int)number;
|
||||
}
|
||||
}
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
}
|
||||
}
|
||||
if (params)
|
||||
weechat_string_free_split (params);
|
||||
weechat_string_free_split (params);
|
||||
}
|
||||
|
||||
weechat_string_free_split (exts);
|
||||
|
||||
@@ -768,11 +768,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
rc = 1;
|
||||
|
||||
end:
|
||||
if (list_keys)
|
||||
weechat_string_free_split (list_keys);
|
||||
weechat_string_free_split (list_keys);
|
||||
free (keys_types);
|
||||
if (list_path)
|
||||
weechat_string_free_split (list_path);
|
||||
weechat_string_free_split (list_path);
|
||||
free (path_returned);
|
||||
free (hdata_head);
|
||||
|
||||
|
||||
@@ -1839,8 +1839,6 @@ end:
|
||||
free (data_unescaped);
|
||||
free (id);
|
||||
free (command);
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
}
|
||||
|
||||
@@ -1567,10 +1567,8 @@ script_action_run_all ()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
}
|
||||
weechat_string_free_split (actions);
|
||||
}
|
||||
|
||||
@@ -966,10 +966,8 @@ script_repo_match_filter (struct t_script_repo *script)
|
||||
}
|
||||
}
|
||||
|
||||
if (words)
|
||||
weechat_string_free_split (words);
|
||||
if (tags)
|
||||
weechat_string_free_split (tags);
|
||||
weechat_string_free_split (words);
|
||||
weechat_string_free_split (tags);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -416,8 +416,7 @@ spell_speller_buffer_new (struct t_gui_buffer *buffer)
|
||||
new_speller_buffer->spellers[num_dicts] = NULL;
|
||||
}
|
||||
}
|
||||
if (dicts)
|
||||
weechat_string_free_split (dicts);
|
||||
weechat_string_free_split (dicts);
|
||||
}
|
||||
|
||||
weechat_hashtable_set (spell_speller_buffer,
|
||||
|
||||
@@ -981,8 +981,7 @@ end:
|
||||
string_modified = (ptr_string && (strcmp (ptr_string, string) != 0)) ?
|
||||
strdup (ptr_string) : NULL;
|
||||
|
||||
if (tags)
|
||||
weechat_string_free_split (tags);
|
||||
weechat_string_free_split (tags);
|
||||
free (string_no_color);
|
||||
|
||||
TRIGGER_CALLBACK_CB_END(string_modified);
|
||||
@@ -1120,8 +1119,7 @@ trigger_callback_line_cb (const void *pointer, void *data,
|
||||
}
|
||||
|
||||
end:
|
||||
if (tags)
|
||||
weechat_string_free_split (tags);
|
||||
weechat_string_free_split (tags);
|
||||
|
||||
TRIGGER_CALLBACK_CB_END(hashtable);
|
||||
}
|
||||
|
||||
@@ -436,8 +436,7 @@ trigger_command_list_default (int verbose)
|
||||
}
|
||||
|
||||
trigger_regex_free (®ex_count, ®ex);
|
||||
if (commands)
|
||||
weechat_string_free_split (commands);
|
||||
weechat_string_free_split (commands);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -838,8 +837,7 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
weechat_buffer_set (buffer, "input_pos", "13");
|
||||
free (input);
|
||||
}
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -1242,8 +1240,7 @@ error:
|
||||
rc = WEECHAT_RC_ERROR;
|
||||
|
||||
end:
|
||||
if (sargv)
|
||||
weechat_string_free_split (sargv);
|
||||
weechat_string_free_split (sargv);
|
||||
|
||||
if (rc == WEECHAT_RC_ERROR)
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
|
||||
@@ -598,10 +598,8 @@ trigger_hook (struct t_trigger *trigger)
|
||||
trigger->name);
|
||||
}
|
||||
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
weechat_string_free_split (argv);
|
||||
weechat_string_free_split (argv_eol);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1235,8 +1233,7 @@ trigger_free (struct t_trigger *trigger)
|
||||
if (trigger->options[i])
|
||||
weechat_config_option_free (trigger->options[i]);
|
||||
}
|
||||
if (trigger->commands)
|
||||
weechat_string_free_split (trigger->commands);
|
||||
weechat_string_free_split (trigger->commands);
|
||||
|
||||
free (trigger);
|
||||
|
||||
|
||||
@@ -440,8 +440,7 @@ typing_typing_set_nick_signal_cb (const void *pointer, void *data,
|
||||
weechat_bar_item_update (TYPING_BAR_ITEM_NAME);
|
||||
|
||||
end:
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
weechat_string_free_split (items);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user