From 2b3517d40f2d8ac728785a21da19db6e1230d010 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 16 Mar 2019 15:29:24 +1030 Subject: [PATCH] io: fix another leak path for always array. Signed-off-by: Rusty Russell --- ccan/io/poll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ccan/io/poll.c b/ccan/io/poll.c index a02152e3..17f93845 100644 --- a/ccan/io/poll.c +++ b/ccan/io/poll.c @@ -91,6 +91,10 @@ static void del_fd(struct fd *fd) pollfds = tal_free(pollfds); fds = NULL; max_fds = 0; + if (num_always == 0) { + always = tal_free(always); + max_always = 0; + } } num_fds--; fd->backend_info = -1; @@ -140,7 +144,7 @@ static void remove_from_always(const struct io_plan *plan) /* Only free if no fds left either. */ if (num_always == 0 && max_fds == 0) { - tal_free(always); + always = tal_free(always); max_always = 0; } } -- 2.39.2