diff --git a/src/mod/channels.mod/tclchan.c b/src/mod/channels.mod/tclchan.c index 512702703..79df93d02 100644 --- a/src/mod/channels.mod/tclchan.c +++ b/src/mod/channels.mod/tclchan.c @@ -1998,17 +1998,17 @@ static void init_masklist(masklist *m) static void init_channel(struct chanset_t *chan, int reset) { int flags = reset ? reset : CHAN_RESETALL; + memberlist *m, *m1; if (flags & CHAN_RESETWHO) { - if (chan->channel.member) { - nfree(chan->channel.member); + for (m = chan->channel.member; m; m = m1) { + m1 = m->next; + nfree(m); } chan->channel.members = 0; chan->channel.member = nmalloc(sizeof *chan->channel.member); /* Since we don't have channel_malloc, manually bzero */ egg_bzero(chan->channel.member, sizeof *chan->channel.member); - chan->channel.member->nick[0] = 0; - chan->channel.member->next = NULL; } if (flags & CHAN_RESETMODES) {