From 8175b1532e4bb1951264e8a6ee5f484137e5306c Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Thu, 18 May 2023 17:25:35 +0200 Subject: [PATCH] Plug econf memory leaks You can see the memory leaks with address sanitizer if shadow is compiled with `--enable-vendordir=/usr/etc`. How to reproduce: 1. Prepare a custom shell file as root ``` mkdir -p /etc/shells.d echo /bin/myshell > /etc/shells.d/custom ``` 2. Run chsh as regular user ``` chsh ``` Signed-off-by: Tobias Stoeckmann --- lib/getdef.c | 2 ++ 1 files changed, 2 insertions(+) diff --git a/lib/getdef.c b/lib/getdef.c index a2a7e484..763d847a 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -522,6 +522,8 @@ static void def_load (void) * syslog. The tools will just use their default values. */ (void)putdef_str (keys[i], value); + + free(value); } econf_free (keys); -- 2.27.0