From: David Goulet Date: Tue, 14 May 2013 16:11:03 +0000 (-0400) Subject: Fix: kernel metadata data leak in error path X-Git-Tag: v2.2.0-rc3~76 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=74024a2182ddbedbbb67fea9dc8b370ff0fd5896;p=lttng-tools.git Fix: kernel metadata data leak in error path Issue 1019922 of coverity scan. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index 856d42310..2c6d1e8c3 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -353,7 +353,7 @@ error: int kernel_open_metadata(struct ltt_kernel_session *session) { int ret; - struct ltt_kernel_metadata *lkm; + struct ltt_kernel_metadata *lkm = NULL; assert(session); @@ -366,7 +366,7 @@ int kernel_open_metadata(struct ltt_kernel_session *session) /* Kernel tracer metadata creation */ ret = kernctl_open_metadata(session->fd, &lkm->conf->attr); if (ret < 0) { - goto error; + goto error_open; } lkm->fd = ret; @@ -382,6 +382,8 @@ int kernel_open_metadata(struct ltt_kernel_session *session) return 0; +error_open: + trace_kernel_destroy_metadata(lkm); error: return -1; }