]> git.proxmox.com Git - mirror_lxc.git/commitdiff
coverity: avoid use of NULL c1
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 4 Sep 2015 18:21:35 +0000 (13:21 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 4 Sep 2015 18:21:35 +0000 (13:21 -0500)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_destroy.c

index 8078b2fe6ea3178cd2104902ca62063458a3f310..39e289cb215144b9f292c9872cfe61584e5ba0fc 100644 (file)
@@ -183,6 +183,8 @@ static int do_destroy_with_snapshots(struct lxc_container *c)
                        if (!(lxcname = strtok_r(NULL, "\n", &scratch)))
                                break;
                        c1 = lxc_container_new(lxcname, lxcpath);
+                       if (!c1)
+                               goto next;
                        if (!c1->destroy(c1)) {
                                fprintf(stderr, "Destroying snapshot %s of %s failed\n", lxcname, my_args.name);
                                lxc_container_put(c1);
@@ -190,6 +192,7 @@ static int do_destroy_with_snapshots(struct lxc_container *c)
                                return -1;
                        }
                        lxc_container_put(c1);
+next:
                        counter++;
                }
                free(buf);