From ef021732eab101776844ec263468004e287fe6e2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 6 Feb 2012 22:49:20 -0500 Subject: [PATCH] Fix memleak in lttng list.c ==26825== 580 bytes in 1 blocks are definitely lost in loss record 13 of 13 ==26825== at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==26825== by 0x4E2F702: lttng_create_handle (lttng-ctl.c:385) ==26825== by 0x403A5F: cmd_list (list.c:255) ==26825== by 0x40217C: main (lttng.c:266) Signed-off-by: Mathieu Desnoyers --- src/bin/lttng/commands/list.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 7c33046eb..6040d008d 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -260,6 +260,7 @@ static int list_ust_events(void) size = lttng_list_tracepoints(handle, &event_list); if (size < 0) { ERR("Unable to list UST events"); + lttng_destroy_handle(handle); return size; } @@ -280,10 +281,12 @@ static int list_ust_events(void) MSG(""); free(event_list); + lttng_destroy_handle(handle); return CMD_SUCCESS; error: + lttng_destroy_handle(handle); return -1; } @@ -311,6 +314,7 @@ static int list_kernel_events(void) size = lttng_list_tracepoints(handle, &event_list); if (size < 0) { ERR("Unable to list kernel events"); + lttng_destroy_handle(handle); return size; } @@ -324,9 +328,11 @@ static int list_kernel_events(void) free(event_list); + lttng_destroy_handle(handle); return CMD_SUCCESS; error: + lttng_destroy_handle(handle); return -1; } -- 2.34.1