From: Mathieu Desnoyers Date: Tue, 13 Apr 2021 15:14:37 +0000 (-0400) Subject: Fix: perf counter context: leak event field structure X-Git-Tag: v2.13.0-rc1~142 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f72cd4d92d052b93bce77fa5761b14fc2a172bdb;p=lttng-ust.git Fix: perf counter context: leak event field structure Signed-off-by: Mathieu Desnoyers Change-Id: Icbe10b546de0561fcbcb2446db68f8f7b2d66923 --- diff --git a/src/liblttng-ust/lttng-context-perf-counters.c b/src/liblttng-ust/lttng-context-perf-counters.c index 39b51f3b..5f5b5cbf 100644 --- a/src/liblttng-ust/lttng-context-perf-counters.c +++ b/src/liblttng-ust/lttng-context-perf-counters.c @@ -62,6 +62,7 @@ struct lttng_perf_counter_field { struct perf_event_attr attr; struct cds_list_head thread_field_list; /* Per-field list of thread fields */ char *name; + struct lttng_ust_event_field *event_field; }; static pthread_key_t perf_counter_key; @@ -504,6 +505,7 @@ void lttng_destroy_perf_counter_ctx_field(void *priv) thread_field_node) lttng_destroy_perf_thread_field(pos); lttng_perf_unlock(); + free(perf_field->event_field); free(perf_field); } @@ -570,6 +572,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, perf_field->attr.exclude_kernel = perf_get_exclude_kernel(); CDS_INIT_LIST_HEAD(&perf_field->thread_field_list); perf_field->name = name_alloc; + perf_field->event_field = event_field; /* Ensure that this perf counter can be used in this process. */ ret = open_perf_fd(&perf_field->attr);