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.4.3~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0481a6e15eacf84671286ba1d15591f08cae8e1f;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 c0ff9d060..e46c70523 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; }