From: Christian Brauner Date: Thu, 7 Dec 2017 14:09:46 +0000 (+0100) Subject: coverity: #1425923 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=241f7d14656d9479a5b5cfc258743ac71d44bb2f;p=thirdparty%2Flxc.git coverity: #1425923 avoid NULL-pointer dereference Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgfs.c b/src/lxc/cgfs.c index 43c715f36..202ce6610 100644 --- a/src/lxc/cgfs.c +++ b/src/lxc/cgfs.c @@ -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;