Skip to content

Commit

Permalink
backtrace: avoid duplicate backtrace objects.
Browse files Browse the repository at this point in the history
This happened in my tal_dump(), and I couldn't see how we ended up
with object having more than one "backtrace".  Adding asserts that we
never added a second backtrace didn't trigger.

Finally I wondered if we were tal_steal() backtraces, and sure enough
we do that blinding in one place: libwally wrapping.  So fix that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Nov 27, 2021
1 parent 6c9b752 commit c1f534a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ void tal_wally_end(const tal_t *parent)
{
tal_t *p;
while ((p = tal_first(wally_tal_ctx)) != NULL) {
if (p != parent)
if (p != parent) {
#if DEVELOPER
/* Don't steal backtrace from wally_tal_ctx! */
if (tal_name(p) && streq(tal_name(p), "backtrace")) {
tal_free(p);
continue;
}
#endif /* DEVELOPER */
tal_steal(parent, p);
}
}
wally_tal_ctx = tal_free(wally_tal_ctx);
}
Expand Down

0 comments on commit c1f534a

Please sign in to comment.