coverity: #1425744

Dereference after null check userns_exec_{1,full} are called from functions that might not have a conf. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 84b489ee
......@@ -3815,6 +3815,9 @@ int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data,
int ret = -1, status = -1;
struct lxc_list *idmap;
if (!conf)
return -EINVAL;
idmap = get_minimal_idmap(conf);
if (!idmap)
return -1;
......@@ -3898,6 +3901,9 @@ int userns_exec_full(struct lxc_conf *conf, int (*fn)(void *), void *data,
struct id_map *container_root_uid = NULL, *container_root_gid = NULL,
*host_uid_map = NULL, *host_gid_map = NULL;
if (!conf)
return -EINVAL;
ret = pipe(p);
if (ret < 0) {
SYSERROR("opening pipe");
......
......@@ -2698,6 +2698,7 @@ static bool do_lxcapi_destroy(struct lxc_container *c)
{
if (!c || !lxcapi_is_defined(c))
return false;
if (has_snapshots(c)) {
ERROR("Container %s has snapshots; not removing", c->name);
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment