diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-12-09 23:04:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-12-09 23:04:17 +0000 |
commit | 03f984d2b965138af2fe9e7b354304de68d8e555 (patch) | |
tree | e06091efecd7061e2df1f751cb42ba6fe4cce0e8 | |
parent | bd7b1745523112c420c060a14a4ea787675cfaac (diff) |
avoid incorrect free; reported by danh@nfol.com, my fix
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index d7ad2ea8d2b..8af519a8fc9 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetgrent.c,v 1.9 2000/08/24 17:04:02 deraadt Exp $ */ +/* $OpenBSD: getnetgrent.c,v 1.10 2000/12/09 23:04:16 deraadt Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.9 2000/08/24 17:04:02 deraadt Exp $"; +static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.10 2000/12/09 23:04:16 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -593,8 +593,7 @@ in_lookup(ypdom, group, key, domain, map) /* Domain specified; look in "group.domain" and "*.domain" */ if ((line = in_lookup1(ypdom, key, domain, map)) == NULL) line = in_lookup1(ypdom, NULL, domain, map); - } - else + } else line = NULL; if (line == NULL) { @@ -706,7 +705,7 @@ innetgr(grp, host, user, domain) { char *ypdom = NULL; #ifdef YP - char *line; + char *line = NULL; #endif int found; struct stringlist *sl; @@ -721,10 +720,11 @@ innetgr(grp, host, user, domain) */ if (_ng_db == NULL) yp_get_default_domain(&ypdom); - else if (lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0) { + else if (lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0) yp_get_default_domain(&ypdom); + + if (line) free(line); - } #endif /* Try the fast lookup first */ |