Skip to content

Commit 8cc86f3

Browse files
committed
trace: prevent memleak report.
notleak() doesn't work for lightningd since the first span is created before memleak (or anything else!) is initialized, so we have to mark it manually. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 3f136ef commit 8cc86f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/trace.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,15 @@ static inline void trace_check_tree(void) {}
184184
static void trace_init(void)
185185
{
186186
const char *dev_trace_file;
187+
const char notleak_name[] = "struct span **NOTLEAK**";
188+
187189
if (active_spans)
188190
return;
189191

190-
active_spans = notleak(tal_arrz(NULL, struct span, 1));
192+
active_spans = tal_arrz(NULL, struct span, 1);
193+
/* We're usually too early for memleak to be initialized, so mark
194+
* this notleak manually! */
195+
tal_set_name(active_spans, notleak_name);
191196

192197
current = NULL;
193198
dev_trace_file = getenv("CLN_DEV_TRACE_FILE");

0 commit comments

Comments
 (0)