avoid NULL-pointer dereference

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2017-12-07 15:09:46 +01:00
parent 94f0035bf6
commit 9d6514f222
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View 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;