From 9d6514f22230e3416f5e4b61359e962c8abdc4d0 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 7 Dec 2017 15:09:46 +0100 Subject: [PATCH] coverity: #1425923 avoid NULL-pointer dereference Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lxc/cgroups/cgfs.c b/src/lxc/cgroups/cgfs.c index efd627f04..a6c26549e 100644 --- a/src/lxc/cgroups/cgfs.c +++ b/src/lxc/cgroups/cgfs.c @@ -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;