diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 19:31:34 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 21:06:47 +0200 |
commit | a59fa70a948eaa93d0708711714bb5cc724451f9 (patch) | |
tree | dc0306f802451716d084dd0b30c088b0e356d064 | |
parent | ac7cc2576328dc4ee4247544d87607a21cbd8fa9 (diff) | |
download | weechat-a59fa70a948eaa93d0708711714bb5cc724451f9.zip |
irc: remove check of NULL pointers before calling weechat_list_free() (issue #865)
-rw-r--r-- | src/plugins/irc/irc-channel.c | 6 | ||||
-rw-r--r-- | tests/unit/core/test-core-list.cpp | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index ddf3f81e3..ce2dca01e 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -1544,10 +1544,8 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) free (channel->away_message); free (channel->pv_remote_nick_color); weechat_unhook (channel->hook_autorejoin); - if (channel->nicks_speaking[0]) - weechat_list_free (channel->nicks_speaking[0]); - if (channel->nicks_speaking[1]) - weechat_list_free (channel->nicks_speaking[1]); + weechat_list_free (channel->nicks_speaking[0]); + weechat_list_free (channel->nicks_speaking[1]); irc_channel_nick_speaking_time_free_all (channel); weechat_hashtable_free (channel->join_smart_filtered); free (channel->buffer_as_string); diff --git a/tests/unit/core/test-core-list.cpp b/tests/unit/core/test-core-list.cpp index 91f9031dd..69c79c557 100644 --- a/tests/unit/core/test-core-list.cpp +++ b/tests/unit/core/test-core-list.cpp @@ -142,6 +142,9 @@ TEST(CoreList, Add) /* free list */ weelist_free (list); + + /* test free of NULL list */ + weelist_free (NULL); } /* |