Subject: lib/30832: Freed memory used in lib/libc/getnetgrent.c
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <tomska@packetfront.com>
List: netbsd-bugs
Date: 07/25/2005 13:51:00
>Number: 30832
>Category: lib
>Synopsis: Freed memory used in lib/libc/getnetgrent.c
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 25 13:51:00 +0000 2005
>Originator: Tomas Skäre
>Release: 1.6
>Organization:
PacketFront
>Environment:
>Description:
Static code analysis run of the NetBSD kernel showed an error in lib/libc/getnetgrent.c, where freed memory was used. I've checked that it's still present in the head branch of the CVS.
>How-To-Repeat:
>Fix:
Diff, if it works. TABs might be messed up from cut&paste, but you get the idea.
--- getnetgrent.c 31 Jul 2003 15:27:23 -0000 1.1.1.1
+++ getnetgrent.c 25 Jul 2005 13:38:43 -0000
@@ -412,8 +412,8 @@
#endif
/* check for cycles */
if (sl_find(sl, grp) != NULL) {
- free(grp);
warnx("netgroup: Cycle in group `%s'", grp);
+ free(grp);
return 0;
}
if (sl_add(sl, grp) == -1) {
@@ -522,8 +522,8 @@
#endif
/* check for cycles */
if (sl_find(sl, grp) != NULL) {
- free(grp);
warnx("netgroup: Cycle in group `%s'", grp);
+ free(grp);
return 0;
}
if (sl_add(sl, grp) == -1) {