Skip to content

Commit

Permalink
coverity: #1425923
Browse files Browse the repository at this point in the history
avoid NULL-pointer dereference

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 17, 2017
1 parent cbbdb23 commit 5f6c648
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lxc/cgroups/cgfs.c
Expand Up @@ -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;
Expand Down

0 comments on commit 5f6c648

Please sign in to comment.