lxc/0047-Fix-memory-leak-in-lxc_global_config_value.patch
2019-12-25 15:57:42 +08:00

45 lines
1.2 KiB
Diff

From fbf9417e0ee9a19cd678e1c493615fa049b547c9 Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68@huawei.com>
Date: Thu, 17 Jan 2019 07:43:23 -0500
Subject: [PATCH 047/131] Fix memory leak in lxc_global_config_value
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
src/lxc/cgroups/cgroup.c | 2 ++
src/lxc/initutils.c | 5 -----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c
index 720a6c93..8d559bea 100644
--- a/src/lxc/cgroups/cgroup.c
+++ b/src/lxc/cgroups/cgroup.c
@@ -95,6 +95,8 @@ void cgroup_exit(struct cgroup_ops *ops)
}
free(ops->hierarchies);
+ free(ops);
+
return;
}
diff --git a/src/lxc/initutils.c b/src/lxc/initutils.c
index 09b521e5..60147a5e 100644
--- a/src/lxc/initutils.c
+++ b/src/lxc/initutils.c
@@ -74,12 +74,7 @@ const char *lxc_global_config_value(const char *option_name)
{ NULL, NULL },
};
- /* placed in the thread local storage pool for non-bionic targets */
-#ifdef HAVE_TLS
- static thread_local const char *values[sizeof(options) / sizeof(options[0])] = {0};
-#else
static const char *values[sizeof(options) / sizeof(options[0])] = {0};
-#endif
/* user_config_path is freed as soon as it is used */
char *user_config_path = NULL;
--
2.23.0