From 50266dc604ac8df63328e84376414de7448869b1 Mon Sep 17 00:00:00 2001 From: Dwight Engen Date: Tue, 29 Oct 2013 14:49:16 -0400 Subject: [PATCH] coverity 1097618: check for NULL return from calloc before deref MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- src/lxc/cgroup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index cf1605af1..6aa449512 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -1688,6 +1688,8 @@ char *cgroup_to_absolute_path(struct cgroup_mount_point *mp, const char *path, c len = strlen(mp->mount_point) + strlen(path) + (suffix ? strlen(suffix) : 0); buf = calloc(len + 1, 1); + if (!buf) + return NULL; rv = snprintf(buf, len + 1, "%s%s%s", mp->mount_point, path, suffix ? suffix : ""); if (rv > len) { free(buf); -- 2.47.2