diff options
author | dd <dd@FreeBSD.org> | 2001-06-13 05:49:37 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2001-06-13 05:49:37 +0000 |
commit | 70471fcd509b462e2df865c942239026ab53833d (patch) | |
tree | ae3ab46ef2d39238a0ab4b12725d94a6b8dda135 /usr.sbin | |
parent | a97b956712bad0390710581f86964ee6917b11e7 (diff) | |
download | FreeBSD-src-70471fcd509b462e2df865c942239026ab53833d.zip FreeBSD-src-70471fcd509b462e2df865c942239026ab53833d.tar.gz |
Plug two memory leaks: call login_close() after login_getclass(), and
use free_entry() instead of free() to free a struct _entry.
PR: 28108
Submitted by: Mark Peek <mark@whistle.com>
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/cron/lib/entry.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/cron/lib/entry.c b/usr.sbin/cron/lib/entry.c index ef05c14..c7562a2 100644 --- a/usr.sbin/cron/lib/entry.c +++ b/usr.sbin/cron/lib/entry.c @@ -262,6 +262,9 @@ load_entry(file, error_func, pw, envp) char *username = cmd; /* temp buffer */ char *s, *group; struct group *grp; +#ifdef LOGIN_CAP + login_cap_t *lc; +#endif Debug(DPARS, ("load_entry()...about to parse username\n")) ch = get_string(username, MAX_COMMAND, file, " \t"); @@ -287,10 +290,11 @@ load_entry(file, error_func, pw, envp) ecode = e_mem; goto eof; } - if (login_getclass(e->class) == NULL) { + if ((lc = login_getclass(e->class)) == NULL) { ecode = e_class; goto eof; } + login_close(lc); #endif grp = NULL; if ((s = strrchr(username, ':')) != NULL) { @@ -416,7 +420,7 @@ load_entry(file, error_func, pw, envp) return e; eof: - free(e); + free_entry(e); if (ecode != e_none && error_func) (*error_func)(ecodes[(int)ecode]); while (ch != EOF && ch != '\n') |