[PATCH v2 3/6] tr2: stop leaking "thread_name" memory
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 26, 2021, 12:22 UTC
- Message-ID
- <patch-v2-3.6-1d835d6767e-20210826T121820Z-avarab@gmail.com>
- In-Reply-To
- <cover-v2-0.6-00000000000-20210826T121820Z-avarab@gmail.com>
Fix a memory leak introduced in ee4512ed481 (trace2: create new combined trace facility, 2019-02-22), we were doing a free() of other memory allocated in tr2tls_create_self(), but not the "thread_name" "struct strbuf".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- trace2/tr2_tls.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/trace2/tr2_tls.c b/trace2/tr2_tls.c index 067c23755fb..7da94aba522 100644 --- a/trace2/tr2_tls.c +++ b/trace2/tr2_tls.c @@ -95,6 +95,7 @@ void tr2tls_unset_self(void) pthread_setspecific(tr2tls_key, NULL); + strbuf_release(&ctx->thread_name); free(ctx->array_us_start); free(ctx); }
-- 2.33.0.733.ga72a4f1c2e1