Commit b089d462 authored by Rusty Russell's avatar Rusty Russell

io: don't leak memory on clean shutdown.

Free the internal "always" array like we free "fds".
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent bc6d22ec
...@@ -137,6 +137,12 @@ static void remove_from_always(const struct io_plan *plan) ...@@ -137,6 +137,12 @@ static void remove_from_always(const struct io_plan *plan)
if (pos != num_always-1) if (pos != num_always-1)
always[pos] = always[num_always-1]; always[pos] = always[num_always-1];
num_always--; num_always--;
/* Only free if no fds left either. */
if (num_always == 0 && max_fds == 0) {
tal_free(always);
max_always = 0;
}
} }
bool backend_new_always(struct io_plan *plan) bool backend_new_always(struct io_plan *plan)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment