[lxc-devel] [PATCH] call lxc_container_put when needed in lxc_destroy.c

S.Çağlar Onur caglar at 10ur.org
Sat Oct 19 04:48:08 UTC 2013


Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
---
 src/lxc/lxc_destroy.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c
index 9983241..1d1e687 100644
--- a/src/lxc/lxc_destroy.c
+++ b/src/lxc/lxc_destroy.c
@@ -108,5 +108,12 @@ int main(int argc, char *argv[])
 		c->stop(c);
 	}
 
-	exit(c->destroy(c) ? 0 : 1);
+	if (!c->destroy(c)) {
+		fprintf(stderr, "Destroying %s failed\n", my_args.name);
+		lxc_container_put(c);
+		exit(1);
+	}
+
+	lxc_container_put(c);
+	return 0;
 }
-- 
1.8.1.2





More information about the lxc-devel mailing list