From: David Goulet Date: Wed, 1 Feb 2012 23:38:13 +0000 (-0500) Subject: Fix memory leak in lttng cli X-Git-Tag: v2.0-pre19~14 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5853fd43129ab32dd54fff779076c67234eb73dc;p=lttng-tools.git Fix memory leak in lttng cli Reported-by: Daniel U. Thibault Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/disable_channels.c b/src/bin/lttng/commands/disable_channels.c index 976611b12..ccd5446db 100644 --- a/src/bin/lttng/commands/disable_channels.c +++ b/src/bin/lttng/commands/disable_channels.c @@ -193,6 +193,9 @@ int cmd_disable_channels(int argc, const char **argv) ret = disable_channels(session_name); end: + if (!opt_session_name && session_name) { + free(session_name); + } poptFreeContext(pc); return ret; } diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c index f447676f3..b30ec1fdc 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -228,6 +228,9 @@ int cmd_disable_events(int argc, const char **argv) ret = disable_events(session_name); end: + if (!opt_session_name && session_name) { + free(session_name); + } poptFreeContext(pc); return ret; } diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c index f094e12fe..692480e81 100644 --- a/src/bin/lttng/commands/enable_channels.c +++ b/src/bin/lttng/commands/enable_channels.c @@ -303,6 +303,9 @@ int cmd_enable_channels(int argc, const char **argv) ret = enable_channel(session_name); end: + if (!opt_session_name && session_name) { + free(session_name); + } poptFreeContext(pc); return ret; }