From ed594980911b1d934726bf2ea8cd2bf338be72c9 Mon Sep 17 00:00:00 2001 From: Christian Babeux Date: Thu, 28 Feb 2013 15:48:29 -0500 Subject: [PATCH] Fix: Memory leak when zmalloc fail on kernel channel allocation Signed-off-by: Christian Babeux Signed-off-by: David Goulet --- src/bin/lttng-sessiond/trace-kernel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 990684be9..6a17776aa 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -158,6 +158,7 @@ struct ltt_kernel_channel *trace_kernel_create_channel( lkc->channel = zmalloc(sizeof(struct lttng_channel)); if (lkc->channel == NULL) { PERROR("lttng_channel zmalloc"); + free(lkc); goto error; } memcpy(lkc->channel, chan, sizeof(struct lttng_channel)); -- 2.34.1