diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-11-14 20:18:10 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-11-14 20:18:10 +0100 |
commit | f1d6f2c40a8e2f7faa85cca2202a4b6ed790c869 (patch) | |
tree | dd0c0c41954888bd0cd2328f6dbe82463d1aa17b | |
parent | bb0967075765620725499b8792f9b53056fce51f (diff) | |
download | weechat-f1d6f2c40a8e2f7faa85cca2202a4b6ed790c869.zip |
irc: fix crash on /upgrade (free channels before server data when a server is destroyed) (bug #37736)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.c | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 27 |
3 files changed, 22 insertions, 15 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.4.0-dev, 2012-11-09 +v0.4.0-dev, 2012-11-14 Version 0.4.0 (under dev!) @@ -28,6 +28,8 @@ Version 0.4.0 (under dev!) aspell.check.suggestions (task #12061) * aspell: fix creation of spellers when number of dictionaries is different between two buffers +* irc: fix crash on /upgrade (free channels before server data when a server + is destroyed) (bug #37736) * irc: fix crash when decoding IRC colors in strings (bug #37704) * irc: fix refresh of bar item "away" after command /away or /disconnect * irc: add command /quiet, fix display of messages 728/729 (quiet list, end of diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index ad99108c8..d47d7c048 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -838,7 +838,10 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) if (channel->next_channel) (channel->next_channel)->prev_channel = channel->prev_channel; - /* free data */ + /* free linked lists */ + irc_nick_free_all (server, channel); + + /* free channel data */ if (channel->name) free (channel->name); if (channel->topic) @@ -847,7 +850,6 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) free (channel->modes); if (channel->key) free (channel->key); - irc_nick_free_all (server, channel); if (channel->away_message) free (channel->away_message); if (channel->pv_remote_nick_color) diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 018cb59b9..43d4dbec9 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1338,7 +1338,21 @@ irc_server_free_data (struct t_irc_server *server) if (!server) return; - /* free data */ + /* free linked lists */ + for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) + { + irc_server_outqueue_free_all (server, i); + } + irc_redirect_free_all (server); + irc_notify_free_all (server); + irc_channel_free_all (server); + + /* free hashtables */ + weechat_hashtable_free (server->join_manual); + weechat_hashtable_free (server->join_channel_key); + weechat_hashtable_free (server->join_noswitch); + + /* free server data */ for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) { if (server->options[i]) @@ -1389,17 +1403,6 @@ irc_server_free_data (struct t_irc_server *server) regfree (server->cmd_list_regexp); free (server->cmd_list_regexp); } - for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) - { - irc_server_outqueue_free_all (server, i); - } - irc_notify_free_all (server); - weechat_hashtable_free (server->join_manual); - weechat_hashtable_free (server->join_channel_key); - weechat_hashtable_free (server->join_noswitch); - irc_redirect_free_all (server); - if (server->channels) - irc_channel_free_all (server); if (server->buffer_as_string) free (server->buffer_as_string); } |