From b83e58a55ce4ac0f2e9b613f53eccde4bce09ff7 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Thu, 18 May 2023 17:48:46 +0200 Subject: [PATCH] lib/shells: Plug econf memory leak You can see the memory leak with address sanitizer if util-linux is compiled with `--with-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/shells.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/shells.c b/lib/shells.c index 6693ab0054..e0d065ee25 100644 --- a/lib/shells.c +++ b/lib/shells.c @@ -53,6 +53,7 @@ extern int is_known_shell(const char *shell_name) break; } } + econf_free (keys); econf_free (key_file); #else char *s; -- 2.47.3