From: Serge Hallyn Date: Fri, 4 Sep 2015 18:21:35 +0000 (-0500) Subject: coverity: avoid use of NULL c1 X-Git-Tag: lxc-2.0.0.beta1~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61111832cdfe6393034d93b3b022ecf14966fc61;p=thirdparty%2Flxc.git coverity: avoid use of NULL c1 Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c index 8078b2fe6..39e289cb2 100644 --- a/src/lxc/lxc_destroy.c +++ b/src/lxc/lxc_destroy.c @@ -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);