Fix: use zmalloc() in lttng list.c
[lttng-tools.git] / src / bin / lttng / commands / list.c
index 7c3211a5927ffc2c34a0f3f5e72528be8c8c4575..14e390a030445c690f03bae266ca16bb1dead774 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
@@ -128,7 +129,7 @@ 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;
@@ -1207,7 +1208,7 @@ static int list_channels(const char *channel_name)
                }
        } else {
                /* Pretty print */
-               if (channel_name == NULL) {
+               if (count) {
                        MSG("Channels:\n-------------");
                }
 
This page took 0.024107 seconds and 4 git commands to generate.