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.4.2~10 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=17ba9d6c94e4329bd182b19e662b9a9a2d232f70;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 75288cd0a..0b1eff265 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");