]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity 1097618: check for NULL return from calloc before deref
authorDwight Engen <dwight.engen@oracle.com>
Tue, 29 Oct 2013 18:49:16 +0000 (14:49 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 29 Oct 2013 18:55:08 +0000 (14:55 -0400)
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/cgroup.c

index cf1605af17e08a3c3a2aaee9269bca88c5178d19..6aa4495127f3d4a5a1750093aac39593c219c6ad 100644 (file)
@@ -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);