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-Tag: v2.6.0-rc4~11 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b2b6465cf44d2bf3cbadabe97b157a527d3660d2;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 3c9975fa9..8763ac96e 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -172,6 +172,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; }