From: Dwight Engen Date: Tue, 29 Oct 2013 18:49:16 +0000 (-0400) Subject: coverity 1097618: check for NULL return from calloc before deref X-Git-Tag: lxc-1.0.0.alpha3~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50266dc604ac8df63328e84376414de7448869b1;p=thirdparty%2Flxc.git coverity 1097618: check for NULL return from calloc before deref Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- 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);