]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/shells: Plug econf memory leak
authorTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 18 May 2023 15:48:46 +0000 (17:48 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 18 May 2023 15:48:46 +0000 (17:48 +0200)
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 <tobias@stoeckmann.org>
lib/shells.c

index 6693ab0054160ef2c0d6b6e69ed61ce4583d1b38..e0d065ee25319fe658cb12279a316a3dbfdda3b0 100644 (file)
@@ -53,6 +53,7 @@ extern int is_known_shell(const char *shell_name)
                        break;
                }
        }
+       econf_free (keys);
        econf_free (key_file);  
 #else
        char *s;