From: Jérémie Galarneau Date: Fri, 4 Jul 2014 19:33:49 +0000 (-0400) Subject: Fix: check malloc return value X-Git-Tag: v2.5.0~26 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b1674e114e764a4234bb09a2691f010a073d8990;p=lttng-tools.git Fix: check malloc return value Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 87935393e..f56adf482 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -117,6 +117,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");