]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425923
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 7 Dec 2017 14:09:46 +0000 (15:09 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Dec 2017 12:24:45 +0000 (13:24 +0100)
avoid NULL-pointer dereference

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfs.c

index efd627f0464e0c24b54f682ed1dc68aa04d15dc4..a6c26549e9fac0697dc759f512a5a32371d18f60 100644 (file)
@@ -555,7 +555,10 @@ static bool find_hierarchy_mountpts( struct cgroup_meta_data *meta_data, char **
                        }
                }
 
-               k = lxc_array_len((void **)h->all_mount_points);
+               if (h)
+                       k = lxc_array_len((void **)h->all_mount_points);
+               else
+                       k = 0;
                r = lxc_grow_array((void ***)&h->all_mount_points, &h->all_mount_point_capacity, k + 1, 4);
                if (r < 0)
                        goto out;