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:25:09 +0000 (17:25 -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 cb4b5074361ebbfe62cbbb83e01812353430b613..1de6940aa8c1612342ba53a56f9e36c7329609e5 100644 (file)
@@ -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;
 }
 
This page took 0.026091 seconds and 4 git commands to generate.