The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3178

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
fix memory leak for  lxc_grow_array
From 6f4c331b1ef939d926becd2dc77a15fd408c48bb Mon Sep 17 00:00:00 2001
From: dongxinhua 00349659 <dongxin...@huawei.com>
Date: Sat, 2 Nov 2019 14:27:14 +0800
Subject: [PATCH] utils: fix memory leak of lxc_grow_array

---
 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 9588a9cd23..cda4ae6354 100644
--- a/src/lxc/string_utils.c
+++ b/src/lxc/string_utils.c
@@ -519,6 +519,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;
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to