Fix: check malloc return value
authorJérémie Galarneau <jeremie.galarneau@gmail.com>
Fri, 4 Jul 2014 19:33:49 +0000 (15:33 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 10 Jul 2014 14:52:35 +0000 (10:52 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/list.c

index fee605fa82ff11a3767feba7f56d565bd6aba899..3e6445d69e6300176326620101c15c906d578d63 100644 (file)
@@ -114,6 +114,10 @@ static char *get_cmdline_by_pid(pid_t pid)
 
        /* Caller must free() *cmdline */
        cmdline = malloc(PATH_MAX);
+       if (!cmdline) {
+               perror("malloc cmdline");
+               goto end;
+       }
        ret = fread(cmdline, 1, PATH_MAX, fp);
        if (ret < 0) {
                perror("fread proc list");
This page took 0.026067 seconds and 4 git commands to generate.