1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Avoid entering an endless loop while traversing the channel list

This commit is contained in:
LemonBoy 2016-04-19 15:29:16 +02:00
parent ed06e43ec8
commit 8f5e200551

View File

@ -168,7 +168,7 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *channel)
{
TEMP_PRINT_REC *temp;
GHashTable *channels;
GSList *tmp, *next, *old;
GSList *tmp, *tmp2, *next, *next2, *old;
g_return_if_fail(server != NULL);
@ -181,11 +181,14 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *channel)
for (tmp = server->netjoins; tmp != NULL; tmp = next) {
NETJOIN_REC *rec = tmp->data;
next = tmp->next;
while (rec->now_channels != NULL) {
char *channel = rec->now_channels->data;
next = g_slist_next(tmp);
for (tmp2 = rec->now_channels; tmp2 != NULL; tmp2 = next2) {
char *channel = tmp2->data;
char *realchannel = channel + 1;
next2 = g_slist_next(tmp2);
if (channel != NULL && strcasecmp(realchannel, channel) != 0)
continue;
@ -217,8 +220,8 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *channel)
g_free(data);
}
rec->now_channels =
g_slist_remove(rec->now_channels, channel);
/* drop tmp2 from the list */
rec->now_channels = g_slist_delete_link(rec->now_channels, tmp2);
g_free(channel);
}