From 19b1b35d31a5e498374e0a53dd44d53c92e11c21 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 Dec 2017 20:49:54 +1030 Subject: [PATCH] memleak: explicitly exclude ccan/io allocation. It's a single, full-lifetime allocation; make sure we only exclude that one, though this is fragile: tests will break if it moves. Signed-off-by: Rusty Russell --- common/memleak.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/memleak.c b/common/memleak.c index ffc333aea..128b23eab 100644 --- a/common/memleak.c +++ b/common/memleak.c @@ -47,13 +47,21 @@ static void children_into_htable(const void *exclude, const tal_t *i; for (i = tal_first(p); i; i = tal_next(i)) { + const char *name = tal_name(i); + if (p == exclude) continue; - /* Don't add backtrace objects. */ - if (tal_name(i) && streq(tal_name(i), "backtrace")) - continue; + if (name) { + /* Don't add backtrace objects. */ + if (streq(name, "backtrace")) + continue; + /* ccan/io allocates pollfd array. */ + if (streq(name, + "ccan/ccan/io/poll.c:40:struct pollfd[]")) + continue; + } htable_add(memtable, hash_ptr(i, NULL), i); children_into_htable(exclude, memtable, i); }