From e8d549cb6e8fdfab9305f0993e708a681405e2bb Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Tue, 28 May 2024 03:47:44 +0200 Subject: [PATCH] Fix leak --- src/mod/channels.mod/tclchan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) {