aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/inetd/inetd.c
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2003-02-23 16:49:14 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2003-02-23 16:49:14 +0000
commitc40f2eef166a2e3c20abb2a0b4cdd800259b9a63 (patch)
treeed350f8c85fc6328a23caad5bd5bd9e351209051 /usr.sbin/inetd/inetd.c
parent7931af6934af3229a90ee0a68cefdac44db0c97e (diff)
downloadsrc-c40f2eef166a2e3c20abb2a0b4cdd800259b9a63.tar.gz
src-c40f2eef166a2e3c20abb2a0b4cdd800259b9a63.zip
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
Notes
Notes: svn path=/head/; revision=111323
Diffstat (limited to 'usr.sbin/inetd/inetd.c')
-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 9e66f2174ad9..238e727bac36 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)