diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 19:01:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 08:53:22 +0200 |
commit | 0b2d9bcb9b04b7e7ac3c2f626422392383575d2b (patch) | |
tree | 177e487efc30717415402ba969b246de3f88b28d /src/plugins/irc | |
parent | 1ad0b4b6699df50e0cc6a3c5d62ce3ac1f77440c (diff) | |
download | weechat-0b2d9bcb9b04b7e7ac3c2f626422392383575d2b.zip |
plugins: remove check of NULL pointers before calling weechat_hashtable_free() (issue #865)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-batch.c | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.c | 9 | ||||
-rw-r--r-- | src/plugins/irc/irc-list.c | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-raw.c | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc-redirect.c | 15 | ||||
-rw-r--r-- | src/plugins/irc/irc-sasl.c | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 21 | ||||
-rw-r--r-- | src/plugins/irc/irc-tag.c | 3 |
8 files changed, 22 insertions, 44 deletions
diff --git a/src/plugins/irc/irc-batch.c b/src/plugins/irc/irc-batch.c index d0ede5db1..a2346f8d7 100644 --- a/src/plugins/irc/irc-batch.c +++ b/src/plugins/irc/irc-batch.c @@ -185,8 +185,7 @@ irc_batch_free (struct t_irc_server *server, struct t_irc_batch *batch) free (batch->parent_ref); free (batch->type); free (batch->parameters); - if (batch->tags) - weechat_hashtable_free (batch->tags); + weechat_hashtable_free (batch->tags); if (batch->messages) weechat_string_dyn_free (batch->messages, 1); @@ -456,8 +455,7 @@ irc_batch_process_multiline (struct t_irc_server *server, } end: - if (hash_tags) - weechat_hashtable_free (hash_tags); + weechat_hashtable_free (hash_tags); if (list_messages) weechat_string_free_split (list_messages); diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 683325fe9..ddf3f81e3 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -402,8 +402,7 @@ irc_channel_create_buffer (struct t_irc_server *server, } end: - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); free (buffer_name); return ptr_buffer; } @@ -1541,8 +1540,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) free (channel->topic); free (channel->modes); free (channel->key); - if (channel->join_msg_received) - weechat_hashtable_free (channel->join_msg_received); + weechat_hashtable_free (channel->join_msg_received); free (channel->away_message); free (channel->pv_remote_nick_color); weechat_unhook (channel->hook_autorejoin); @@ -1551,8 +1549,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) if (channel->nicks_speaking[1]) weechat_list_free (channel->nicks_speaking[1]); irc_channel_nick_speaking_time_free_all (channel); - if (channel->join_smart_filtered) - weechat_hashtable_free (channel->join_smart_filtered); + weechat_hashtable_free (channel->join_smart_filtered); free (channel->buffer_as_string); free (channel); diff --git a/src/plugins/irc/irc-list.c b/src/plugins/irc/irc-list.c index 9806bffb3..abef27d57 100644 --- a/src/plugins/irc/irc-list.c +++ b/src/plugins/irc/irc-list.c @@ -956,8 +956,7 @@ irc_list_create_buffer (struct t_irc_server *server) &irc_input_data_cb, NULL, NULL, &irc_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); irc_list_buffer_set_localvar_filter (buffer, server); diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c index 7aac2d54f..0ab77202f 100644 --- a/src/plugins/irc/irc-raw.c +++ b/src/plugins/irc/irc-raw.c @@ -123,8 +123,7 @@ irc_raw_message_match_filter (struct t_irc_raw_message *raw_message, hashtable, irc_raw_filter_hashtable_options); match = (result && (strcmp (result, "1") == 0)) ? 1 : 0; - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); free (result); return match; } @@ -407,8 +406,7 @@ irc_raw_open (int switch_to_buffer) buffer_props, &irc_input_data_cb, NULL, NULL, &irc_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); /* failed to create buffer ? then return */ if (!irc_raw_buffer) diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 69b04e2c3..456c03581 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -770,8 +770,7 @@ irc_redirect_stop (struct t_irc_redirect *redirect, const char *error) redirect->signal, redirect->pattern); (void) weechat_hook_hsignal_send (signal_name, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); irc_redirect_free (redirect); } @@ -977,14 +976,10 @@ irc_redirect_free (struct t_irc_redirect *redirect) free (redirect->signal); free (redirect->string); free (redirect->command); - if (redirect->cmd_start) - weechat_hashtable_free (redirect->cmd_start); - if (redirect->cmd_stop) - weechat_hashtable_free (redirect->cmd_stop); - if (redirect->cmd_extra) - weechat_hashtable_free (redirect->cmd_extra); - if (redirect->cmd_filter) - weechat_hashtable_free (redirect->cmd_filter); + weechat_hashtable_free (redirect->cmd_start); + weechat_hashtable_free (redirect->cmd_stop); + weechat_hashtable_free (redirect->cmd_extra); + weechat_hashtable_free (redirect->cmd_filter); free (redirect->output); free (redirect); diff --git a/src/plugins/irc/irc-sasl.c b/src/plugins/irc/irc-sasl.c index 6c5343fe2..75f7e252c 100644 --- a/src/plugins/irc/irc-sasl.c +++ b/src/plugins/irc/irc-sasl.c @@ -473,8 +473,7 @@ irc_sasl_get_key_content (const char *sasl_key, char **sasl_error) if (options) weechat_hashtable_set (options, "directory", "config"); key_path = weechat_string_eval_path_home (sasl_key, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (key_path) content = weechat_file_get_content (key_path); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index d6051b2c7..066f11ab3 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -378,10 +378,8 @@ irc_server_eval_expression (struct t_irc_server *server, const char *string) value = weechat_string_eval_expression (string, pointers, extra_vars, NULL); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); return value; } @@ -1582,8 +1580,7 @@ irc_server_get_default_msg (const char *default_msg, msg = weechat_string_eval_expression (default_msg, NULL, extra_vars, NULL); - if (extra_vars) - weechat_hashtable_free (extra_vars); + weechat_hashtable_free (extra_vars); return msg; } @@ -2310,10 +2307,8 @@ irc_server_free_data (struct t_irc_server *server) free (server->nick); free (server->nick_modes); free (server->host); - if (server->cap_ls) - weechat_hashtable_free (server->cap_ls); - if (server->cap_list) - weechat_hashtable_free (server->cap_list); + weechat_hashtable_free (server->cap_ls); + weechat_hashtable_free (server->cap_list); free (server->isupport); free (server->prefix_modes); free (server->prefix_chars); @@ -4763,8 +4758,7 @@ irc_server_create_buffer (struct t_irc_server *server) buffer_props, &irc_input_data_cb, NULL, NULL, &irc_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); if (!server->buffer) return NULL; @@ -5248,8 +5242,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, weechat_hashtable_set (options, "directory", "config"); cert_path = weechat_string_eval_path_home (ptr_cert_path, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (cert_path) { cert_str = weechat_file_get_content (cert_path); diff --git a/src/plugins/irc/irc-tag.c b/src/plugins/irc/irc-tag.c index 4ec61dea0..45851d330 100644 --- a/src/plugins/irc/irc-tag.c +++ b/src/plugins/irc/irc-tag.c @@ -429,8 +429,7 @@ irc_tag_add_tags_to_message (const char *message, struct t_hashtable *tags) end: free (msg_str_tags); - if (msg_hash_tags) - weechat_hashtable_free (msg_hash_tags); + weechat_hashtable_free (msg_hash_tags); free (new_tags); return (result) ? weechat_string_dyn_free (result, 0) : NULL; |