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>
This commit is contained in:
parent
db957588c9
commit
fa0590b3d3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78156
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user