From: Mathieu Desnoyers Date: Wed, 17 Mar 2021 19:24:59 +0000 (-0400) Subject: Fix: perf counters context: error handling on type allocation X-Git-Tag: v2.13.0-rc1~257 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ea8efbbe07e4b524fb308963ff5b0868fa14806f;p=lttng-ust.git Fix: perf counters context: error handling on type allocation Found by Coverity: ** CID 1450865: Resource leaks (RESOURCE_LEAK) /liblttng-ust/lttng-context-perf-counters.c: 606 in lttng_add_perf_counter_to_ct) Signed-off-by: Mathieu Desnoyers Change-Id: I9b0cf29ceb4f8c95f0905455cda4c157c7a37165 --- diff --git a/liblttng-ust/lttng-context-perf-counters.c b/liblttng-ust/lttng-context-perf-counters.c index 53ff3cbc..f8241c39 100644 --- a/liblttng-ust/lttng-context-perf-counters.c +++ b/liblttng-ust/lttng-context-perf-counters.c @@ -548,7 +548,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, lttng_alignof(uint64_t) * CHAR_BIT, lttng_is_signed_type(uint64_t), BYTE_ORDER, 10); - if (!type) { + if (!ust_type) { ret = -ENOMEM; goto type_alloc_error; }