Fix: Memory leak on error in alloc_argv_from_user_opts()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 27 Nov 2014 22:23:48 +0000 (17:23 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 27 Nov 2014 22:23:48 +0000 (17:23 -0500)
*** CID 1256181:  Resource leak  (RESOURCE_LEAK)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/view.c

index c0ff9d06046936650a3e921ecd92a5c2070d1632..e46c7052392103f43f9df3965b21cd6efe9b85cb 100644 (file)
@@ -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;
 }
 
This page took 0.029018 seconds and 4 git commands to generate.