From f853d85dfb6625f1e97a9b908377886af993e327 Mon Sep 17 00:00:00 2001
From: liuhao <liuhao27@huawei.com>
Date: Thu, 11 Apr 2019 20:34:51 +0800
Subject: [PATCH 083/131] lxc: free lxc-handler

free handler if failed

Signed-off-by: liuhao <liuhao27@huawei.com>
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
 src/lxc/start.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index 87e07d33..f1cd7fa3 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -695,6 +695,10 @@ void lxc_zero_handler(struct lxc_handler *handler)
 
 void lxc_free_handler(struct lxc_handler *handler)
 {
+	if (handler == NULL) {
+		return;
+	}
+
 	if (handler->pinfd >= 0)
 		close(handler->pinfd);
 
@@ -2761,8 +2765,8 @@ retry:
 		ret = -1;
 	}
 
-	lxc_free_handler(handler);
 out:
+	lxc_free_handler(handler);
 	return ret;
 }
 
-- 
2.23.0

