From: Jérémie Galarneau Date: Thu, 27 Nov 2014 22:23:48 +0000 (-0500) Subject: Fix: Memory leak on error in alloc_argv_from_user_opts() X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=879ba54843fc94133be5ce15b4c73b5fdd6d4f98;p=lttng-tools.git Fix: Memory leak on error in alloc_argv_from_user_opts() *** CID 1256181: Resource leak (RESOURCE_LEAK) Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index cb4b50743..1de6940aa 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -173,6 +173,13 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path) return argv; error: + if (argv) { + for (i = 0; i < num_opts + 2; i++) { + free(argv[i]); + } + free(argv); + } + return NULL; }