1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

After calling login_getclass, be sure to call login_close so that

we don't leak memory. Only one of these two cases (reconfig) actually
causes a leak because the other is usually followed by an exec.

PR:		46845
Reviewed by:	David Wang <dsw@juniper.net>
MFC after:	2 weeks
This commit is contained in:
David Malone 2003-02-23 16:49:14 +00:00
parent 7931af6934
commit c40f2eef16
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111323

View File

@ -833,6 +833,7 @@ main(int argc, char **argv)
sep->se_service, sep->se_user);
_exit(EX_OSERR);
}
login_close(lc);
#else
if (pwd->pw_uid) {
if (setlogin(sep->se_user) < 0) {
@ -971,6 +972,9 @@ config(void)
struct servtab *sep, *new, **sepp;
long omask;
int new_nomapped;
#ifdef LOGIN_CAP
login_cap_t *lc = NULL;
#endif
if (!setconfig()) {
syslog(LOG_ERR, "%s: %m", CONFIG);
@ -992,13 +996,14 @@ config(void)
continue;
}
#ifdef LOGIN_CAP
if (login_getclass(new->se_class) == NULL) {
if ((lc = login_getclass(new->se_class)) == NULL) {
/* error syslogged by getclass */
syslog(LOG_ERR,
"%s/%s: %s: login class error, service ignored",
new->se_service, new->se_proto, new->se_class);
continue;
}
login_close(lc);
#endif
new_nomapped = new->se_nomapped;
for (sep = servtab; sep; sep = sep->se_next)