summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2003-02-23 16:49:14 +0000
committerdwmalone <dwmalone@FreeBSD.org>2003-02-23 16:49:14 +0000
commit1825d6d17dc5133b018a2bacfbf1949153cc05be (patch)
treeed350f8c85fc6328a23caad5bd5bd9e351209051 /usr.sbin
parentc5067989e21761faaf5e0efc5bfc951cb02f27a5 (diff)
downloadFreeBSD-src-1825d6d17dc5133b018a2bacfbf1949153cc05be.zip
FreeBSD-src-1825d6d17dc5133b018a2bacfbf1949153cc05be.tar.gz
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
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/inetd/inetd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 9e66f21..238e727 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -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)
OpenPOWER on IntegriCloud