From e4e1fa469228db6d54c4945bbcdbd5abe52bb1ca Mon Sep 17 00:00:00 2001 From: Li Lu <1487442471@qq.com> Date: Tue, 19 May 2026 15:07:33 +0800 Subject: [PATCH] lxc/caps: fix cap_to_text() memory cleanup Signed-off-by: DreamConnected <1487442471@qq.com> Origin: upstream, https://github.com/lxc/lxc/pull/4685/changes/e4e1fa469228db6d54c4945bbcdbd5abe52bb1ca Bug: https://github.com/lxc/lxc/issues/4670 --- src/lxc/caps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/caps.c b/src/lxc/caps.c index 206488ff4..f6c5770ed 100644 --- a/src/lxc/caps.c +++ b/src/lxc/caps.c @@ -88,7 +88,7 @@ int lxc_caps_up(void) int lxc_ambient_caps_up(void) { call_cleaner(cap_free) cap_t caps = NULL; - __do_free char *cap_names = NULL; + char *cap_names = NULL; int ret; cap_value_t cap; cap_value_t last_cap = CAP_LAST_CAP; @@ -135,6 +135,7 @@ int lxc_ambient_caps_up(void) return log_warn_errno(0, errno, "Failed to convert capabilities %d", cap); TRACE("Raised %s in inheritable and ambient capability set", cap_names); + cap_free(cap_names); return 0; } -- 2.43.0