memleak: make "_notleak" names less powerful.

They previously prevented any child from being detected as leaks, now
they just mark the tal allocation itself as not being a leak.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2020-09-23 11:07:04 +09:30
parent 7b55d6cfe2
commit 161cc3e840
2 changed files with 6 additions and 4 deletions

View File

@ -122,6 +122,9 @@ static void parse_include(const char *filename, bool must_exist, bool early,
/* Only valid forms are "foo" and "foo=bar" */
all_args[i] = tal_fmt(all_args, "--%s", lines[i]);
}
/* This isn't a leak either */
if (all_args[i])
tal_set_name(all_args[i], TAL_LABEL(config_notleak, ""));
}
/*

View File

@ -77,10 +77,6 @@ static void children_into_htable(const void *exclude1, const void *exclude2,
if (strends(name, "struct io_plan *[]") && !tal_parent(i))
continue;
/* Other notleak internals. */
if (strends(name, "_notleak"))
continue;
/* Don't add tmpctx. */
if (streq(name, "tmpctx"))
continue;
@ -244,6 +240,9 @@ static void call_memleak_helpers(struct htable *memtable, const tal_t *p)
else
pointer_referenced(memtable, p);
memleak_scan_region(memtable, p, tal_bytelen(p));
} else if (name && strends(name, "_notleak")) {
pointer_referenced(memtable, i);
call_memleak_helpers(memtable, i);
} else {
call_memleak_helpers(memtable, i);
}