From 2e6f54021ee4b2b81fb0119714f1c4fffb4a031f Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Fri, 19 Nov 2021 15:11:23 +0800
Subject: [PATCH 02/14] fix memleak when use multiple --volumes-from

Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
 src/daemon/modules/spec/specs_mount.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/daemon/modules/spec/specs_mount.c b/src/daemon/modules/spec/specs_mount.c
index 175a0fbe..6b6ac87d 100644
--- a/src/daemon/modules/spec/specs_mount.c
+++ b/src/daemon/modules/spec/specs_mount.c
@@ -2773,6 +2773,11 @@ static int calc_volumes_from_len(host_config *host_spec, size_t *len)
         if (cont->common_config != NULL && cont->common_config->mount_points != NULL) {
             *len += cont->common_config->mount_points->len;
         }
+
+        free(id);
+        id = NULL;
+        container_unref(cont);
+        cont = NULL;
     }
 
 out:
-- 
2.25.1

