From 0ee04c25700268e91f2f0bb7974b1ececf3aa380 Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sun, 2 Jun 2024 21:03:29 +0200 Subject: [PATCH] Fix leak Patch by: michaelortmann --- 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) {