1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 09:13:14 +02:00

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

This commit is contained in:
Sébastien Helleu
2024-04-25 00:21:54 +02:00
parent 828ca37225
commit 529a22e342
14 changed files with 34 additions and 71 deletions
+1 -2
View File
@@ -1545,8 +1545,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
weechat_hashtable_free (channel->join_msg_received);
free (channel->away_message);
free (channel->pv_remote_nick_color);
if (channel->hook_autorejoin)
weechat_unhook (channel->hook_autorejoin);
weechat_unhook (channel->hook_autorejoin);
if (channel->nicks_speaking[0])
weechat_list_free (channel->nicks_speaking[0]);
if (channel->nicks_speaking[1])
+2 -6
View File
@@ -1252,9 +1252,7 @@ irc_notify_print_log (struct t_irc_server *server)
void
irc_notify_hook_timer_ison ()
{
if (irc_notify_timer_ison)
weechat_unhook (irc_notify_timer_ison);
weechat_unhook (irc_notify_timer_ison);
irc_notify_timer_ison = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_ison),
0, 0, &irc_notify_timer_ison_cb, NULL, NULL);
@@ -1267,9 +1265,7 @@ irc_notify_hook_timer_ison ()
void
irc_notify_hook_timer_whois ()
{
if (irc_notify_timer_whois)
weechat_unhook (irc_notify_timer_whois);
weechat_unhook (irc_notify_timer_whois);
irc_notify_timer_whois = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_whois),
0, 0, &irc_notify_timer_whois_cb, NULL, NULL);
+1 -2
View File
@@ -1246,8 +1246,7 @@ IRC_PROTOCOL_CALLBACK(cap)
irc_server_sendf (ctxt->server, 0, NULL, str_msg_auth_upper);
free (str_msg_auth_upper);
}
if (ctxt->server->hook_timer_sasl)
weechat_unhook (ctxt->server->hook_timer_sasl);
weechat_unhook (ctxt->server->hook_timer_sasl);
timeout = IRC_SERVER_OPTION_INTEGER(
ctxt->server, IRC_SERVER_OPTION_SASL_TIMEOUT);
ctxt->server->hook_timer_sasl = weechat_hook_timer (
+6 -12
View File
@@ -2298,16 +2298,11 @@ irc_server_free_data (struct t_irc_server *server)
free (server->retry_array);
free (server->current_address);
free (server->current_ip);
if (server->hook_connect)
weechat_unhook (server->hook_connect);
if (server->hook_fd)
weechat_unhook (server->hook_fd);
if (server->hook_timer_connection)
weechat_unhook (server->hook_timer_connection);
if (server->hook_timer_sasl)
weechat_unhook (server->hook_timer_sasl);
if (server->hook_timer_anti_flood)
weechat_unhook (server->hook_timer_anti_flood);
weechat_unhook (server->hook_connect);
weechat_unhook (server->hook_fd);
weechat_unhook (server->hook_timer_connection);
weechat_unhook (server->hook_timer_sasl);
weechat_unhook (server->hook_timer_anti_flood);
irc_server_free_sasl_data (server);
free (server->unterminated_message);
if (server->nicks_array)
@@ -4396,8 +4391,7 @@ irc_server_login (struct t_irc_server *server)
(realname && realname[0]) ? realname : ((username2) ? username2 : "weechat"));
free (username2);
if (server->hook_timer_connection)
weechat_unhook (server->hook_timer_connection);
weechat_unhook (server->hook_timer_connection);
server->hook_timer_connection = weechat_hook_timer (
IRC_SERVER_OPTION_INTEGER (server, IRC_SERVER_OPTION_CONNECTION_TIMEOUT) * 1000,
0, 1,