From a7e618379e42b1a87798754c65844668b99ac645 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 15 Apr 2022 01:29:46 -0400 Subject: [PATCH] Fix: lttng: enable-rotation: leak of command parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ==1759491==ERROR: LeakSanitizer: detected memory leaks Direct leak of 6 byte(s) in 1 object(s) allocated from: #0 0x7fdbdc94add9 in __interceptor_malloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7fdbdc4a0c09 (/usr/lib/libpopt.so.0+0x3c09) Signed-off-by: Jérémie Galarneau Change-Id: I29cc6ec4390e71829107f309f162247b9be2868c --- src/bin/lttng/commands/enable_rotation.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/lttng/commands/enable_rotation.c b/src/bin/lttng/commands/enable_rotation.c index ce69d34e1..2dd3cae2d 100644 --- a/src/bin/lttng/commands/enable_rotation.c +++ b/src/bin/lttng/commands/enable_rotation.c @@ -179,6 +179,10 @@ int cmd_enable_rotation(int argc, const char **argv) } while ((opt = poptGetNextOpt(pc)) != -1) { + if (opt_arg) { + free(opt_arg); + opt_arg = NULL; + } switch (opt) { case OPT_HELP: SHOW_HELP(); @@ -333,6 +337,7 @@ end: if (free_session_name) { free(session_name); } + free(opt_arg); return cmd_ret; error: -- 2.34.1