From: Christian Babeux Date: Thu, 28 Feb 2013 20:48:29 +0000 (-0500) Subject: Fix: Memory leak when zmalloc fail on kernel channel allocation X-Git-Tag: v2.2.0-rc1~49 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=ed594980911b1d934726bf2ea8cd2bf338be72c9 Fix: Memory leak when zmalloc fail on kernel channel allocation Signed-off-by: Christian Babeux Signed-off-by: David Goulet --- 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));