mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user