[lttng-dev] [PATCH lttng-tools] Fix: Memory leak when zmalloc fail on kernel channel allocation

Christian Babeux christian.babeux at efficios.com
Thu Feb 28 15:48:29 EST 2013


Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
---
 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 48be065..8839a00 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));
-- 
1.8.1.3




More information about the lttng-dev mailing list