Skip to content

Commit c1f534a

Browse files
committed
backtrace: avoid duplicate backtrace objects.
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>
1 parent 6c9b752 commit c1f534a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

common/utils.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ void tal_wally_end(const tal_t *parent)
3232
{
3333
tal_t *p;
3434
while ((p = tal_first(wally_tal_ctx)) != NULL) {
35-
if (p != parent)
35+
if (p != parent) {
36+
#if DEVELOPER
37+
/* Don't steal backtrace from wally_tal_ctx! */
38+
if (tal_name(p) && streq(tal_name(p), "backtrace")) {
39+
tal_free(p);
40+
continue;
41+
}
42+
#endif /* DEVELOPER */
3643
tal_steal(parent, p);
44+
}
3745
}
3846
wally_tal_ctx = tal_free(wally_tal_ctx);
3947
}

0 commit comments

Comments
 (0)