From 4845445079d142d779bd6968429057a6a736beb9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 15 Mar 2018 15:00:38 +1030 Subject: [PATCH] memleak: ignore tmpctx. Signed-off-by: Rusty Russell --- common/memleak.c | 4 ++++ common/utils.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/memleak.c b/common/memleak.c index 3bd64628b..ac3eec359 100644 --- a/common/memleak.c +++ b/common/memleak.c @@ -100,6 +100,10 @@ static void children_into_htable(const void *exclude1, const void *exclude2, if (streq(name, "ccan/ccan/io/poll.c:40:struct pollfd[]")) continue; + + /* Don't add tmpctx. */ + if (streq(name, "tmpctx")) + continue; } htable_add(memtable, hash_ptr(i, NULL), i); children_into_htable(exclude1, exclude2, memtable, i); diff --git a/common/utils.c b/common/utils.c index cdf5353bd..602b42f19 100644 --- a/common/utils.c +++ b/common/utils.c @@ -31,7 +31,7 @@ u8 *tal_hexdata(const tal_t *ctx, const void *str, size_t len) /* Initial creation of tmpctx. */ void setup_tmpctx(void) { - tmpctx = tal(NULL, char); + tmpctx = tal_alloc_(NULL, 0, false, false, "tmpctx"); } /* Free any children of tmpctx. */ @@ -40,6 +40,6 @@ void clean_tmpctx(void) /* Minor optimization: don't do anything if tmpctx unused. */ if (tal_first(tmpctx)) { tal_free(tmpctx); - tmpctx = tal(NULL, char); + tmpctx = tal_alloc_(NULL, 0, false, false, "tmpctx"); } }