From 2f31e50aa14fccd46387e40c312ea59c96dbc678 Mon Sep 17 00:00:00 2001
From: liuhao <liuhao27@huawei.com>
Date: Thu, 11 Apr 2019 22:36:42 +0800
Subject: [PATCH 084/131] lxc: memory leak of lxc_grow_array

fix memory leak of lxc_grow_array

Signed-off-by: liuhao <liuhao27@huawei.com>
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
 src/lxc/string_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lxc/string_utils.c b/src/lxc/string_utils.c
index 0d7538c1..31c43407 100644
--- a/src/lxc/string_utils.c
+++ b/src/lxc/string_utils.c
@@ -523,6 +523,7 @@ int lxc_grow_array(void ***array, size_t *capacity, size_t new_size, size_t capa
 	/* first time around, catch some trivial mistakes of the user
 	 * only initializing one of these */
 	if (!*array || !*capacity) {
+		free(*array);
 		*array = NULL;
 		*capacity = 0;
 	}
-- 
2.23.0

