Skip to content

Commit

Permalink
memleak: ignore tmpctx.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Mar 16, 2018
1 parent ef2a063 commit 4845445
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions common/memleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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");
}
}

0 comments on commit 4845445

Please sign in to comment.