projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bc6d22e
)
io: don't leak memory on clean shutdown.
author
Rusty Russell
<rusty@rustcorp.com.au>
Sat, 16 Mar 2019 04:27:05 +0000
(14:57 +1030)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Sat, 16 Mar 2019 04:27:05 +0000
(14:57 +1030)
Free the internal "always" array like we free "fds".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/poll.c
patch
|
blob
|
history
diff --git
a/ccan/io/poll.c
b/ccan/io/poll.c
index 95b6103287d6335b0b84e4475a7b8469a2d33b54..a02152e3792ae07569d4a75b1ca423ecce5fb626 100644
(file)
--- a/
ccan/io/poll.c
+++ b/
ccan/io/poll.c
@@
-137,6
+137,12
@@
static void remove_from_always(const struct io_plan *plan)
if (pos != num_always-1)
always[pos] = always[num_always-1];
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)