Fix: Possible call to execvp with NULL argument on allocation failure
[lttng-tools.git] / src / bin / lttng / commands / view.c
index c0ff9d06046936650a3e921ecd92a5c2070d1632..b6d2bffb0587c22b11acace439e3d49017517fa6 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;
 }
 
@@ -274,7 +281,7 @@ static int spawn_viewer(const char *trace_path)
                break;
        }
 
-       if (argv == NULL) {
+       if (argv == NULL || !viewer_bin) {
                ret = CMD_FATAL;
                goto error;
        }
This page took 0.025206 seconds and 4 git commands to generate.