]> 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>
Wed, 7 Feb 2018 11:18:11 +0000 (12:18 +0100)
avoid NULL-pointer dereference

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

index 43c715f36ea9bca397f4761c44dedf4e66c804d7..202ce6610f64f087ded781ad9cf09f567b839ede 100644 (file)
@@ -538,7 +538,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;