diff --git a/image.c b/image.c index b58d18264..d1945ac33 100644 --- a/image.c +++ b/image.c @@ -36,12 +36,15 @@ int check_img_inventory(void) fdinfo_per_id = he->has_fdinfo_per_id ? he->fdinfo_per_id : false; ret = he->img_version; - root_ids = xmalloc(sizeof(*root_ids)); - if (!root_ids) - return -1; - memcpy(root_ids, he->root_ids, sizeof(*root_ids)); - inventory_entry__free_unpacked(he, NULL); + if (he->root_ids) { + root_ids = xmalloc(sizeof(*root_ids)); + if (!root_ids) + return -1; + + memcpy(root_ids, he->root_ids, sizeof(*root_ids)); + inventory_entry__free_unpacked(he, NULL); + } if (ret != CRTOOLS_IMAGES_V1) { pr_err("Not supported images version %u\n", ret); diff --git a/namespaces.c b/namespaces.c index 07fe22bce..76b3ef23e 100644 --- a/namespaces.c +++ b/namespaces.c @@ -284,6 +284,11 @@ int check_ns_ids(struct pstree_item *item) struct pstree_item *p = item->parent; if (!p) { + if (!root_ids) { + current_ns_mask = opts.rst_namespaces_flags; + return 0; + } + current_ns_mask = get_clone_mask(item->ids, root_ids); pr_info("Will restore in %lx namespaces\n", current_ns_mask); return 0;