memleak: prepare for htable to be a tal object.

Since it gets resized during traverse, we would crash by
keeping a pointer to the old one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-01-03 15:16:52 +10:30
parent 81e57dce52
commit 851cbf6c83
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ static void children_into_htable(struct htable *memtable, const tal_t *p)
if (streq(name, "tmpctx"))
continue;
}
/* Don't add (resizing!) memtable table! */
if (i == memtable->table)
continue;
htable_add(memtable, hash_ptr(i, NULL), i);
children_into_htable(memtable, i);
}