Fix: use zmalloc() in lttng list.c
[lttng-tools.git] / src / bin / lttng / commands / list.c
index 75288cd0a5867f0f005cc6c45913bfef71c69c71..5f452e58958d1e5a0fa2a4eff4a919a6e1141e46 100644 (file)
@@ -116,7 +116,11 @@ static char *get_cmdline_by_pid(pid_t pid)
        }
 
        /* Caller must free() *cmdline */
-       cmdline = malloc(PATH_MAX);
+       cmdline = zmalloc(PATH_MAX);
+       if (!cmdline) {
+               perror("malloc cmdline");
+               goto end;
+       }
        ret = fread(cmdline, 1, PATH_MAX, fp);
        if (ret < 0) {
                perror("fread proc list");
@@ -684,7 +688,7 @@ static int list_channels(const char *channel_name)
                goto error_channels;
        }
 
-       if (channel_name == NULL) {
+       if (count) {
                MSG("Channels:\n-------------");
        }
 
This page took 0.029517 seconds and 4 git commands to generate.