mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 22:05:41 +02:00
irc: remove check of NULL pointers before calling free() (issue #865)
This commit is contained in:
@@ -292,8 +292,7 @@ irc_bar_item_buffer_modes (const void *pointer, void *data,
|
||||
"%s%s",
|
||||
IRC_COLOR_ITEM_CHANNEL_MODES,
|
||||
(modes_without_args) ? modes_without_args : channel->modes);
|
||||
if (modes_without_args)
|
||||
free (modes_without_args);
|
||||
free (modes_without_args);
|
||||
return strdup (modes);
|
||||
}
|
||||
|
||||
|
||||
+12
-24
@@ -181,14 +181,10 @@ irc_batch_add_message (struct t_irc_server *server, const char *reference,
|
||||
void
|
||||
irc_batch_free (struct t_irc_server *server, struct t_irc_batch *batch)
|
||||
{
|
||||
if (batch->reference)
|
||||
free (batch->reference);
|
||||
if (batch->parent_ref)
|
||||
free (batch->parent_ref);
|
||||
if (batch->type)
|
||||
free (batch->type);
|
||||
if (batch->parameters)
|
||||
free (batch->parameters);
|
||||
free (batch->reference);
|
||||
free (batch->parent_ref);
|
||||
free (batch->type);
|
||||
free (batch->parameters);
|
||||
if (batch->tags)
|
||||
weechat_hashtable_free (batch->tags);
|
||||
if (batch->messages)
|
||||
@@ -295,17 +291,14 @@ irc_batch_process_messages (struct t_irc_server *server,
|
||||
|
||||
free (message);
|
||||
free (message2);
|
||||
if (command)
|
||||
free (command);
|
||||
if (channel)
|
||||
free (channel);
|
||||
free (command);
|
||||
free (channel);
|
||||
}
|
||||
weechat_string_free_split (list_messages);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_messages)
|
||||
free (new_messages);
|
||||
free (new_messages);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -455,16 +448,11 @@ irc_batch_process_multiline (struct t_irc_server *server,
|
||||
if (text)
|
||||
weechat_string_dyn_concat (result, text, -1);
|
||||
}
|
||||
if (tags)
|
||||
free (tags);
|
||||
if (host)
|
||||
free (host);
|
||||
if (command)
|
||||
free (command);
|
||||
if (channel)
|
||||
free (channel);
|
||||
if (text)
|
||||
free (text);
|
||||
free (tags);
|
||||
free (host);
|
||||
free (command);
|
||||
free (channel);
|
||||
free (text);
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
@@ -404,8 +404,7 @@ irc_channel_create_buffer (struct t_irc_server *server,
|
||||
end:
|
||||
if (buffer_props)
|
||||
weechat_hashtable_free (buffer_props);
|
||||
if (buffer_name)
|
||||
free (buffer_name);
|
||||
free (buffer_name);
|
||||
return ptr_buffer;
|
||||
}
|
||||
|
||||
@@ -587,8 +586,7 @@ irc_channel_set_buffer_title (struct t_irc_channel *channel)
|
||||
channel->topic,
|
||||
(weechat_config_boolean (irc_config_look_topic_strip_colors)) ? 0 : 1);
|
||||
weechat_buffer_set (channel->buffer, "title", title_color);
|
||||
if (title_color)
|
||||
free (title_color);
|
||||
free (title_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -616,8 +614,7 @@ irc_channel_set_topic (struct t_irc_channel *channel, const char *topic)
|
||||
&& topic && topic[0]
|
||||
&& (strcmp (channel->topic, topic) != 0));
|
||||
|
||||
if (channel->topic)
|
||||
free (channel->topic);
|
||||
free (channel->topic);
|
||||
channel->topic = (topic) ? strdup (topic) : NULL;
|
||||
|
||||
irc_channel_set_buffer_title (channel);
|
||||
@@ -663,9 +660,7 @@ irc_channel_set_topic_private_buffers (struct t_irc_server *server,
|
||||
void
|
||||
irc_channel_set_modes (struct t_irc_channel *channel, const char *modes)
|
||||
{
|
||||
if (channel->modes)
|
||||
free (channel->modes);
|
||||
|
||||
free (channel->modes);
|
||||
channel->modes = (modes) ? strdup (modes) : NULL;
|
||||
}
|
||||
|
||||
@@ -749,8 +744,7 @@ irc_channel_remove_account (struct t_irc_server *server,
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (ptr_nick->account)
|
||||
free (ptr_nick->account);
|
||||
free (ptr_nick->account);
|
||||
ptr_nick->account = NULL;
|
||||
}
|
||||
}
|
||||
@@ -995,8 +989,7 @@ irc_channel_nick_speaking_time_free (struct t_irc_channel *channel,
|
||||
return;
|
||||
|
||||
/* free data */
|
||||
if (nick_speaking->nick)
|
||||
free (nick_speaking->nick);
|
||||
free (nick_speaking->nick);
|
||||
|
||||
/* remove nick from list */
|
||||
if (nick_speaking->prev_nick)
|
||||
@@ -1361,8 +1354,7 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
|
||||
line = weechat_hdata_move (hdata_line, line, -1);
|
||||
}
|
||||
|
||||
if (nick_to_search)
|
||||
free (nick_to_search);
|
||||
free (nick_to_search);
|
||||
|
||||
weechat_hashtable_remove (channel->join_smart_filtered, nick);
|
||||
}
|
||||
@@ -1545,20 +1537,14 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
|
||||
irc_modelist_free_all (channel);
|
||||
|
||||
/* free channel data */
|
||||
if (channel->name)
|
||||
free (channel->name);
|
||||
if (channel->topic)
|
||||
free (channel->topic);
|
||||
if (channel->modes)
|
||||
free (channel->modes);
|
||||
if (channel->key)
|
||||
free (channel->key);
|
||||
free (channel->name);
|
||||
free (channel->topic);
|
||||
free (channel->modes);
|
||||
free (channel->key);
|
||||
if (channel->join_msg_received)
|
||||
weechat_hashtable_free (channel->join_msg_received);
|
||||
if (channel->away_message)
|
||||
free (channel->away_message);
|
||||
if (channel->pv_remote_nick_color)
|
||||
free (channel->pv_remote_nick_color);
|
||||
free (channel->away_message);
|
||||
free (channel->pv_remote_nick_color);
|
||||
if (channel->hook_autorejoin)
|
||||
weechat_unhook (channel->hook_autorejoin);
|
||||
if (channel->nicks_speaking[0])
|
||||
@@ -1568,8 +1554,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
|
||||
irc_channel_nick_speaking_time_free_all (channel);
|
||||
if (channel->join_smart_filtered)
|
||||
weechat_hashtable_free (channel->join_smart_filtered);
|
||||
if (channel->buffer_as_string)
|
||||
free (channel->buffer_as_string);
|
||||
free (channel->buffer_as_string);
|
||||
|
||||
free (channel);
|
||||
|
||||
|
||||
@@ -103,8 +103,7 @@ irc_color_convert_rgb2term (long rgb)
|
||||
info_color = weechat_info_get ("color_rgb2term", str_color);
|
||||
if (!info_color || !info_color[0])
|
||||
{
|
||||
if (info_color)
|
||||
free (info_color);
|
||||
free (info_color);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -144,8 +143,7 @@ irc_color_convert_rgb2irc (long rgb)
|
||||
info_color = weechat_info_get ("color_rgb2term", str_color);
|
||||
if (!info_color || !info_color[0])
|
||||
{
|
||||
if (info_color)
|
||||
free (info_color);
|
||||
free (info_color);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -180,8 +178,7 @@ irc_color_convert_term2irc (int color)
|
||||
info_color = weechat_info_get ("color_term2rgb", str_color);
|
||||
if (!info_color || !info_color[0])
|
||||
{
|
||||
if (info_color)
|
||||
free (info_color);
|
||||
free (info_color);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -924,8 +921,7 @@ irc_color_decode_ansi_cb (void *data, const char *text)
|
||||
end:
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
if (text2)
|
||||
free (text2);
|
||||
free (text2);
|
||||
|
||||
return (output) ? output : strdup ("");
|
||||
}
|
||||
@@ -956,14 +952,12 @@ irc_color_decode_ansi (const char *string, int keep_colors)
|
||||
ansi_regex,
|
||||
REG_EXTENDED) != 0)
|
||||
{
|
||||
if (ansi_regex)
|
||||
free (ansi_regex);
|
||||
free (ansi_regex);
|
||||
free (irc_color_regex_ansi);
|
||||
irc_color_regex_ansi = NULL;
|
||||
return NULL;
|
||||
}
|
||||
if (ansi_regex)
|
||||
free (ansi_regex);
|
||||
free (ansi_regex);
|
||||
}
|
||||
|
||||
ansi_state.keep_colors = keep_colors;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -594,8 +594,7 @@ irc_completion_channel_topic_cb (const void *pointer, void *data,
|
||||
weechat_completion_list_add (completion,
|
||||
(topic) ? topic : ptr_channel->topic,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
if (topic)
|
||||
free (topic);
|
||||
free (topic);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -245,8 +245,7 @@ irc_config_compute_nick_colors ()
|
||||
if (irc_server_strcasecmp (ptr_server, ptr_nick->name,
|
||||
ptr_server->nick) != 0)
|
||||
{
|
||||
if (ptr_nick->color)
|
||||
free (ptr_nick->color);
|
||||
free (ptr_nick->color);
|
||||
ptr_nick->color = irc_nick_find_color (ptr_nick->name);
|
||||
}
|
||||
}
|
||||
@@ -1219,8 +1218,7 @@ irc_config_check_autojoin (const char *autojoin)
|
||||
rc = 1;
|
||||
|
||||
end:
|
||||
if (string)
|
||||
free (string);
|
||||
free (string);
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
if (channels)
|
||||
@@ -1567,8 +1565,7 @@ irc_config_msgbuffer_create_option_cb (const void *pointer, void *data,
|
||||
weechat_prefix ("error"), IRC_PLUGIN_NAME,
|
||||
option_name, option_name);
|
||||
}
|
||||
if (name_lower)
|
||||
free (name_lower);
|
||||
free (name_lower);
|
||||
|
||||
ptr_option = weechat_config_new_option (
|
||||
config_file, section,
|
||||
@@ -1685,8 +1682,7 @@ irc_config_ctcp_create_option_cb (const void *pointer, void *data,
|
||||
weechat_prefix ("error"), IRC_PLUGIN_NAME, pos_name,
|
||||
option_name);
|
||||
}
|
||||
if (name_lower)
|
||||
free (name_lower);
|
||||
free (name_lower);
|
||||
|
||||
ptr_option = weechat_config_new_option (
|
||||
config_file, section,
|
||||
@@ -2999,8 +2995,7 @@ irc_config_update_cb (const void *pointer, void *data,
|
||||
weechat_hashtable_set (data_read, "value", new_value);
|
||||
changes++;
|
||||
}
|
||||
if (new_value)
|
||||
free (new_value);
|
||||
free (new_value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-31
File diff suppressed because it is too large
Load Diff
@@ -309,17 +309,14 @@ irc_ignore_free (struct t_irc_ignore *ignore)
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (ignore->mask)
|
||||
free (ignore->mask);
|
||||
free (ignore->mask);
|
||||
if (ignore->regex_mask)
|
||||
{
|
||||
regfree (ignore->regex_mask);
|
||||
free (ignore->regex_mask);
|
||||
}
|
||||
if (ignore->server)
|
||||
free (ignore->server);
|
||||
if (ignore->channel)
|
||||
free (ignore->channel);
|
||||
free (ignore->server);
|
||||
free (ignore->channel);
|
||||
|
||||
/* remove ignore from list */
|
||||
if (ignore->prev_ignore)
|
||||
|
||||
@@ -300,12 +300,9 @@ irc_info_info_irc_buffer_cb (const void *pointer, void *data,
|
||||
if (server && ptr_server && channel)
|
||||
ptr_channel = irc_channel_search (ptr_server, channel);
|
||||
|
||||
if (server)
|
||||
free (server);
|
||||
if (channel)
|
||||
free (channel);
|
||||
if (host)
|
||||
free (host);
|
||||
free (server);
|
||||
free (channel);
|
||||
free (host);
|
||||
|
||||
if (ptr_channel)
|
||||
{
|
||||
|
||||
@@ -165,8 +165,7 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
"%sself_msg,notify_none,no_highlight,prefix_nick_%s",
|
||||
(ctcp_type) ? "irc_ctcp," : "",
|
||||
(str_color) ? str_color : "default");
|
||||
if (str_color)
|
||||
free (str_color);
|
||||
free (str_color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,10 +274,8 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
(ptr_text) ? ptr_text : "");
|
||||
}
|
||||
|
||||
if (text2)
|
||||
free (text2);
|
||||
if (text_decoded)
|
||||
free (text_decoded);
|
||||
free (text2);
|
||||
free (text_decoded);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -406,8 +403,7 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags,
|
||||
free (msg);
|
||||
}
|
||||
|
||||
if (data_with_colors)
|
||||
free (data_with_colors);
|
||||
free (data_with_colors);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -580,8 +576,7 @@ irc_input_send_cb (const void *pointer, void *data,
|
||||
weechat_command (
|
||||
ptr_buffer,
|
||||
(data_with_colors) ? data_with_colors : ptr_message);
|
||||
if (data_with_colors)
|
||||
free (data_with_colors);
|
||||
free (data_with_colors);
|
||||
}
|
||||
|
||||
/* reset tags to use by default */
|
||||
@@ -589,14 +584,10 @@ irc_input_send_cb (const void *pointer, void *data,
|
||||
}
|
||||
}
|
||||
|
||||
if (server)
|
||||
free (server);
|
||||
if (channel)
|
||||
free (channel);
|
||||
if (options)
|
||||
free (options);
|
||||
if (tags)
|
||||
free (tags);
|
||||
free (server);
|
||||
free (channel);
|
||||
free (options);
|
||||
free (tags);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -194,10 +194,8 @@ irc_join_compare_sort_buffer_cb (void *data, struct t_arraylist *arraylist,
|
||||
void
|
||||
irc_join_free_join_channel (struct t_irc_join_channel *join_channel)
|
||||
{
|
||||
if (join_channel->name)
|
||||
free (join_channel->name);
|
||||
if (join_channel->key)
|
||||
free (join_channel->key);
|
||||
free (join_channel->name);
|
||||
free (join_channel->key);
|
||||
|
||||
free (join_channel);
|
||||
}
|
||||
@@ -274,8 +272,7 @@ irc_join_arraylist_add (struct t_arraylist *arraylist,
|
||||
{
|
||||
free (ptr_join_chan_exact->name);
|
||||
ptr_join_chan_exact->name = strdup (join_channel->name);
|
||||
if (ptr_join_chan_exact->key)
|
||||
free (ptr_join_chan_exact->key);
|
||||
free (ptr_join_chan_exact->key);
|
||||
ptr_join_chan_exact->key = (join_channel->key) ?
|
||||
strdup (join_channel->key) : NULL;
|
||||
return 0;
|
||||
@@ -655,8 +652,7 @@ irc_join_add_channel_to_autojoin (struct t_irc_server *server,
|
||||
free (new_autojoin);
|
||||
}
|
||||
|
||||
if (old_autojoin)
|
||||
free (old_autojoin);
|
||||
free (old_autojoin);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -680,8 +676,7 @@ irc_join_add_channels_to_autojoin (struct t_irc_server *server,
|
||||
free (new_autojoin);
|
||||
}
|
||||
|
||||
if (old_autojoin)
|
||||
free (old_autojoin);
|
||||
free (old_autojoin);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -755,8 +750,7 @@ irc_join_remove_channel_from_autojoin (struct t_irc_server *server,
|
||||
free (new_autojoin);
|
||||
}
|
||||
|
||||
if (old_autojoin)
|
||||
free (old_autojoin);
|
||||
free (old_autojoin);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -875,8 +869,7 @@ irc_join_rename_channel_in_autojoin (struct t_irc_server *server,
|
||||
free (new_autojoin);
|
||||
}
|
||||
|
||||
if (old_autojoin)
|
||||
free (old_autojoin);
|
||||
free (old_autojoin);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -966,8 +959,7 @@ irc_join_sort_autojoin (struct t_irc_server *server, enum t_irc_join_sort sort)
|
||||
|
||||
if (!old_autojoin || !old_autojoin[0])
|
||||
{
|
||||
if (old_autojoin)
|
||||
free (old_autojoin);
|
||||
free (old_autojoin);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -978,6 +970,5 @@ irc_join_sort_autojoin (struct t_irc_server *server, enum t_irc_join_sort sort)
|
||||
free (new_autojoin);
|
||||
}
|
||||
|
||||
if (old_autojoin)
|
||||
free (old_autojoin);
|
||||
free (old_autojoin);
|
||||
}
|
||||
|
||||
@@ -101,12 +101,9 @@ irc_list_free_cb (void *data, struct t_arraylist *arraylist, void *pointer)
|
||||
ptr_channel = (struct t_irc_list_channel *)pointer;
|
||||
if (ptr_channel)
|
||||
{
|
||||
if (ptr_channel->name)
|
||||
free (ptr_channel->name);
|
||||
if (ptr_channel->name2)
|
||||
free (ptr_channel->name2);
|
||||
if (ptr_channel->topic)
|
||||
free (ptr_channel->topic);
|
||||
free (ptr_channel->name);
|
||||
free (ptr_channel->name2);
|
||||
free (ptr_channel->topic);
|
||||
free (ptr_channel);
|
||||
}
|
||||
}
|
||||
@@ -255,8 +252,7 @@ irc_list_channel_match_filter (struct t_irc_server *server,
|
||||
irc_list_filter_hashtable_extra_vars,
|
||||
irc_list_filter_hashtable_options);
|
||||
match = (result && (strcmp (result, "1") == 0)) ? 1 : 0;
|
||||
if (result)
|
||||
free (result);
|
||||
free (result);
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -451,8 +447,7 @@ irc_list_parse_messages (struct t_irc_server *server, const char *output)
|
||||
weechat_arraylist_add (server->list->channels, channel);
|
||||
}
|
||||
}
|
||||
if (command)
|
||||
free (command);
|
||||
free (command);
|
||||
if (params)
|
||||
weechat_string_free_split (params);
|
||||
}
|
||||
|
||||
@@ -511,24 +511,15 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
|
||||
snprintf (str_pos, sizeof (str_pos), "%d", pos_text);
|
||||
weechat_hashtable_set (hashtable, "pos_text", str_pos);
|
||||
|
||||
if (tags)
|
||||
free (tags);
|
||||
if (message_without_tags)
|
||||
free (message_without_tags);
|
||||
if (nick)
|
||||
free (nick);
|
||||
if (user)
|
||||
free (user);
|
||||
if (host)
|
||||
free (host);
|
||||
if (command)
|
||||
free (command);
|
||||
if (channel)
|
||||
free (channel);
|
||||
if (arguments)
|
||||
free (arguments);
|
||||
if (text)
|
||||
free (text);
|
||||
free (tags);
|
||||
free (message_without_tags);
|
||||
free (nick);
|
||||
free (user);
|
||||
free (host);
|
||||
free (command);
|
||||
free (channel);
|
||||
free (arguments);
|
||||
free (text);
|
||||
if (params)
|
||||
weechat_string_free_split (params);
|
||||
|
||||
@@ -845,14 +836,10 @@ irc_message_ignored (struct t_irc_server *server, const char *message)
|
||||
nick,
|
||||
host_no_color);
|
||||
|
||||
if (nick)
|
||||
free (nick);
|
||||
if (host)
|
||||
free (host);
|
||||
if (host_no_color)
|
||||
free (host_no_color);
|
||||
if (channel)
|
||||
free (channel);
|
||||
free (nick);
|
||||
free (host);
|
||||
free (host_no_color);
|
||||
free (channel);
|
||||
|
||||
return ignored;
|
||||
}
|
||||
@@ -1840,8 +1827,7 @@ end:
|
||||
arguments);
|
||||
}
|
||||
|
||||
if (tags)
|
||||
free (tags);
|
||||
free (tags);
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
|
||||
@@ -300,26 +300,21 @@ irc_mode_channel_update (struct t_irc_server *server,
|
||||
if (str_temp)
|
||||
{
|
||||
snprintf (str_temp, length, "%s %s", new_modes, new_args);
|
||||
if (channel->modes)
|
||||
free (channel->modes);
|
||||
free (channel->modes);
|
||||
channel->modes = str_temp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel->modes)
|
||||
free (channel->modes);
|
||||
free (channel->modes);
|
||||
channel->modes = strdup (new_modes);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
if (new_modes)
|
||||
free (new_modes);
|
||||
if (new_args)
|
||||
free (new_args);
|
||||
if (str_modes)
|
||||
free (str_modes);
|
||||
free (new_modes);
|
||||
free (new_args);
|
||||
free (str_modes);
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (channel->modes && (strcmp (channel->modes, "+") == 0))
|
||||
@@ -484,8 +479,7 @@ irc_mode_channel_set (struct t_irc_server *server,
|
||||
&& ptr_arg && (strcmp (ptr_arg, "*") != 0))
|
||||
{
|
||||
/* replace key for +k, but ignore "*" as new key */
|
||||
if (channel->key)
|
||||
free (channel->key);
|
||||
free (channel->key);
|
||||
channel->key = strdup (ptr_arg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,10 +323,8 @@ irc_modelist_item_free (struct t_irc_modelist *modelist,
|
||||
(item->next_item)->prev_item = item->prev_item;
|
||||
|
||||
/* free item data */
|
||||
if (item->mask)
|
||||
free (item->mask);
|
||||
if (item->setter)
|
||||
free (item->setter);
|
||||
free (item->mask);
|
||||
free (item->setter);
|
||||
free (item);
|
||||
|
||||
modelist->items = new_items;
|
||||
|
||||
+21
-42
File diff suppressed because it is too large
Load Diff
@@ -149,8 +149,7 @@ irc_notify_set_server_option (struct t_irc_server *server)
|
||||
str2 = realloc (str, total_length);
|
||||
if (!str2)
|
||||
{
|
||||
if (str)
|
||||
free (str);
|
||||
free (str);
|
||||
return;
|
||||
}
|
||||
str = str2;
|
||||
@@ -298,8 +297,7 @@ irc_notify_build_message_with_nicks (struct t_irc_server *server,
|
||||
message2 = realloc (message, total_length);
|
||||
if (!message2)
|
||||
{
|
||||
if (message)
|
||||
free (message);
|
||||
free (message);
|
||||
message = NULL;
|
||||
break;
|
||||
}
|
||||
@@ -352,8 +350,7 @@ irc_notify_send_monitor (struct t_irc_server *server)
|
||||
weechat_hashtable_free (hashtable);
|
||||
}
|
||||
}
|
||||
if (message)
|
||||
free (message);
|
||||
free (message);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -464,8 +461,7 @@ irc_notify_free (struct t_irc_server *server, struct t_irc_notify *notify,
|
||||
}
|
||||
free (notify->nick);
|
||||
}
|
||||
if (notify->away_message)
|
||||
free (notify->away_message);
|
||||
free (notify->away_message);
|
||||
|
||||
/* remove notify from list */
|
||||
if (notify->prev_notify)
|
||||
@@ -667,8 +663,7 @@ irc_notify_send_signal (struct t_irc_notify *notify,
|
||||
|
||||
(void) weechat_hook_signal_send (signal, WEECHAT_HOOK_SIGNAL_STRING, data);
|
||||
|
||||
if (data)
|
||||
free (data);
|
||||
free (data);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -797,8 +792,7 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
|
||||
irc_notify_send_signal (notify, "still_away", away_message);
|
||||
}
|
||||
|
||||
if (notify->away_message)
|
||||
free (notify->away_message);
|
||||
free (notify->away_message);
|
||||
notify->away_message = (away_message) ? strdup (away_message) : NULL;
|
||||
}
|
||||
|
||||
@@ -1037,10 +1031,8 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (irc_cmd)
|
||||
free (irc_cmd);
|
||||
if (arguments)
|
||||
free (arguments);
|
||||
free (irc_cmd);
|
||||
free (arguments);
|
||||
}
|
||||
}
|
||||
if (!away_message_updated && !no_such_nick)
|
||||
@@ -1106,8 +1098,7 @@ irc_notify_timer_ison_cb (const void *pointer, void *data, int remaining_calls)
|
||||
weechat_hashtable_free (hashtable);
|
||||
}
|
||||
}
|
||||
if (message)
|
||||
free (message);
|
||||
free (message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+107
-214
File diff suppressed because it is too large
Load Diff
@@ -125,8 +125,7 @@ irc_raw_message_match_filter (struct t_irc_raw_message *raw_message,
|
||||
match = (result && (strcmp (result, "1") == 0)) ? 1 : 0;
|
||||
if (hashtable)
|
||||
weechat_hashtable_free (hashtable);
|
||||
if (result)
|
||||
free (result);
|
||||
free (result);
|
||||
return match;
|
||||
}
|
||||
else if (strncmp (filter, "s:", 2) == 0)
|
||||
@@ -177,8 +176,7 @@ irc_raw_message_match_filter (struct t_irc_raw_message *raw_message,
|
||||
NULL); /* pos_text */
|
||||
match = (command && (weechat_strcasecmp (command, filter + 2) == 0)) ?
|
||||
1 : 0;
|
||||
if (command)
|
||||
free (command);
|
||||
free (command);
|
||||
return match;
|
||||
}
|
||||
else
|
||||
@@ -309,10 +307,8 @@ irc_raw_message_print (struct t_irc_raw_message *raw_message)
|
||||
prefix,
|
||||
(buf2) ? buf2 : ((buf) ? buf : raw_message->message));
|
||||
|
||||
if (buf)
|
||||
free (buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
free (buf);
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -441,8 +437,7 @@ irc_raw_open (int switch_to_buffer)
|
||||
void
|
||||
irc_raw_set_filter (const char *filter)
|
||||
{
|
||||
if (irc_raw_filter)
|
||||
free (irc_raw_filter);
|
||||
free (irc_raw_filter);
|
||||
irc_raw_filter = (filter && (strcmp (filter, "*") != 0)) ?
|
||||
strdup (filter) : NULL;
|
||||
irc_raw_set_localvar_filter ();
|
||||
@@ -487,8 +482,7 @@ irc_raw_message_free (struct t_irc_raw_message *raw_message)
|
||||
(raw_message->next_message)->prev_message = raw_message->prev_message;
|
||||
|
||||
/* free data */
|
||||
if (raw_message->message)
|
||||
free (raw_message->message);
|
||||
free (raw_message->message);
|
||||
|
||||
free (raw_message);
|
||||
|
||||
|
||||
@@ -362,14 +362,10 @@ irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
|
||||
(redirect_pattern->next_redirect)->prev_redirect = redirect_pattern->prev_redirect;
|
||||
|
||||
/* free data */
|
||||
if (redirect_pattern->name)
|
||||
free (redirect_pattern->name);
|
||||
if (redirect_pattern->cmd_start)
|
||||
free (redirect_pattern->cmd_start);
|
||||
if (redirect_pattern->cmd_stop)
|
||||
free (redirect_pattern->cmd_stop);
|
||||
if (redirect_pattern->cmd_extra)
|
||||
free (redirect_pattern->cmd_extra);
|
||||
free (redirect_pattern->name);
|
||||
free (redirect_pattern->cmd_start);
|
||||
free (redirect_pattern->cmd_stop);
|
||||
free (redirect_pattern->cmd_extra);
|
||||
|
||||
free (redirect_pattern);
|
||||
|
||||
@@ -977,14 +973,10 @@ irc_redirect_free (struct t_irc_redirect *redirect)
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (redirect->pattern)
|
||||
free (redirect->pattern);
|
||||
if (redirect->signal)
|
||||
free (redirect->signal);
|
||||
if (redirect->string)
|
||||
free (redirect->string);
|
||||
if (redirect->command)
|
||||
free (redirect->command);
|
||||
free (redirect->pattern);
|
||||
free (redirect->signal);
|
||||
free (redirect->string);
|
||||
free (redirect->command);
|
||||
if (redirect->cmd_start)
|
||||
weechat_hashtable_free (redirect->cmd_start);
|
||||
if (redirect->cmd_stop)
|
||||
@@ -993,8 +985,7 @@ irc_redirect_free (struct t_irc_redirect *redirect)
|
||||
weechat_hashtable_free (redirect->cmd_extra);
|
||||
if (redirect->cmd_filter)
|
||||
weechat_hashtable_free (redirect->cmd_filter);
|
||||
if (redirect->output)
|
||||
free (redirect->output);
|
||||
free (redirect->output);
|
||||
|
||||
free (redirect);
|
||||
|
||||
|
||||
+21
-42
File diff suppressed because it is too large
Load Diff
+62
-124
File diff suppressed because it is too large
Load Diff
@@ -261,8 +261,7 @@ irc_tag_parse (const char *tags,
|
||||
key);
|
||||
unescaped = irc_tag_unescape_value (pos + 1);
|
||||
weechat_hashtable_set (hashtable, str_key, unescaped);
|
||||
if (unescaped)
|
||||
free (unescaped);
|
||||
free (unescaped);
|
||||
free (key);
|
||||
num_tags++;
|
||||
}
|
||||
@@ -314,8 +313,7 @@ irc_tag_add_to_string_cb (void *data,
|
||||
weechat_string_dyn_concat (string,
|
||||
(escaped) ? escaped : (const char *)value,
|
||||
-1);
|
||||
if (escaped)
|
||||
free (escaped);
|
||||
free (escaped);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,12 +428,10 @@ irc_tag_add_tags_to_message (const char *message, struct t_hashtable *tags)
|
||||
weechat_string_dyn_concat (result, ptr_message, -1);
|
||||
|
||||
end:
|
||||
if (msg_str_tags)
|
||||
free (msg_str_tags);
|
||||
free (msg_str_tags);
|
||||
if (msg_hash_tags)
|
||||
weechat_hashtable_free (msg_hash_tags);
|
||||
if (new_tags)
|
||||
free (new_tags);
|
||||
free (new_tags);
|
||||
|
||||
return (result) ? weechat_string_dyn_free (result, 0) : NULL;
|
||||
}
|
||||
|
||||
@@ -500,16 +500,14 @@ irc_upgrade_read_cb (const void *pointer, void *data,
|
||||
str = weechat_infolist_string (infolist, "prefix_modes");
|
||||
if (str)
|
||||
{
|
||||
if (irc_upgrade_current_server->prefix_modes)
|
||||
free (irc_upgrade_current_server->prefix_modes);
|
||||
free (irc_upgrade_current_server->prefix_modes);
|
||||
irc_upgrade_current_server->prefix_modes = strdup (str);
|
||||
}
|
||||
/* "prefix_chars" is new in WeeChat 0.3.4 */
|
||||
str = weechat_infolist_string (infolist, "prefix_chars");
|
||||
if (str)
|
||||
{
|
||||
if (irc_upgrade_current_server->prefix_chars)
|
||||
free (irc_upgrade_current_server->prefix_chars);
|
||||
free (irc_upgrade_current_server->prefix_chars);
|
||||
irc_upgrade_current_server->prefix_chars = strdup (str);
|
||||
}
|
||||
/* "msg_max_length" is new in WeeChat 4.0.0 */
|
||||
|
||||
@@ -263,8 +263,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
info_auto_connect = weechat_info_get ("auto_connect", NULL);
|
||||
auto_connect = (info_auto_connect && (strcmp (info_auto_connect, "1") == 0)) ?
|
||||
1 : 0;
|
||||
if (info_auto_connect)
|
||||
free (info_auto_connect);
|
||||
free (info_auto_connect);
|
||||
|
||||
/* look at arguments */
|
||||
for (i = 0; i < argc; i++)
|
||||
|
||||
Reference in New Issue
Block a user