diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-08-14 10:51:07 +0200 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2018-10-21 17:39:24 +0200 |
commit | 11abc94bd0bae5e40555362630367bf0f27c8c13 (patch) | |
tree | e04ddf825ef3c1bcdc13dd421c7a717a368fd4a1 | |
parent | error, error_at_line: Add missing va_end calls (diff) | |
download | glibc-11abc94bd0bae5e40555362630367bf0f27c8c13.tar.gz glibc-11abc94bd0bae5e40555362630367bf0f27c8c13.tar.bz2 glibc-11abc94bd0bae5e40555362630367bf0f27c8c13.zip |
nscd: Deallocate existing user names in file parser
This avoids a theoretical memory leak (theoretical because it depends on
multiple server-user/stat-user directives in the configuration file).
(cherry picked from commit 2d7acfac3ebf266dcbc82d0d6cc576f626953a03)
(cherry picked from commit bfcfa22589f2b4277a65e60c6b736b6bbfbd87d0)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | nscd/nscd_conf.c | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2018-08-14 Florian Weimer <fweimer@redhat.com> + + * nscd/nscd_conf.c (nscd_parse_file): Deallocate old storage for + server_user, stat_user. + 2018-08-13 Florian Weimer <fweimer@redhat.com> * misc/error.c (error): Add missing va_end call. diff --git a/nscd/nscd_conf.c b/nscd/nscd_conf.c index 265a02434d..7293b795b6 100644 --- a/nscd/nscd_conf.c +++ b/nscd/nscd_conf.c @@ -190,7 +190,10 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb]) if (!arg1) error (0, 0, _("Must specify user name for server-user option")); else - server_user = xstrdup (arg1); + { + free ((char *) server_user); + server_user = xstrdup (arg1); + } } else if (strcmp (entry, "stat-user") == 0) { @@ -198,6 +201,7 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb]) error (0, 0, _("Must specify user name for stat-user option")); else { + free ((char *) stat_user); stat_user = xstrdup (arg1); struct passwd *pw = getpwnam (stat_user); |