Skip to content

Commit

Permalink
common: Add a tracing state cleanup at exit
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker committed Nov 20, 2024
1 parent 1dcf31e commit 8493b0a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,21 @@ static void trace_inject_traceparent(void)
}
}

static void trace_free(void)
{
current = NULL;
free(active_spans);
active_spans = NULL;
}

static void trace_init(void) {
if (active_spans)
return;
active_spans = calloc(MAX_ACTIVE_SPANS, sizeof(struct span));

current = NULL;
trace_inject_traceparent();
atexit(trace_free);
}

/**
Expand Down

0 comments on commit 8493b0a

Please sign in to comment.