Module Name: src
Committed By: martin
Date: Mon Mar 11 20:05:15 UTC 2024
Modified Files:
src/lib/libc/gen [netbsd-8]: getcap.c
Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1947):
lib/libc/gen/getcap.c: revision 1.58
Fix memory leak in getent()
Memory was not freed if record was not found
To generate a diff of this commit:
cvs rdiff -u -r1.56.8.1 -r1.56.8.2 src/lib/libc/gen/getcap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/gen/getcap.c
diff -u src/lib/libc/gen/getcap.c:1.56.8.1 src/lib/libc/gen/getcap.c:1.56.8.2
--- src/lib/libc/gen/getcap.c:1.56.8.1 Tue Jul 4 12:57:45 2017
+++ src/lib/libc/gen/getcap.c Mon Mar 11 20:05:15 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: getcap.c,v 1.56.8.1 2017/07/04 12:57:45 martin Exp $ */
+/* $NetBSD: getcap.c,v 1.56.8.2 2024/03/11 20:05:15 martin Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94";
#else
-__RCSID("$NetBSD: getcap.c,v 1.56.8.1 2017/07/04 12:57:45 martin Exp $");
+__RCSID("$NetBSD: getcap.c,v 1.56.8.2 2024/03/11 20:05:15 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -502,8 +502,10 @@ getent(char **cap, size_t *len, const ch
break;
}
- if (!foundit)
+ if (!foundit) {
+ free(record);
return -1;
+ }
/*
* Got the capability record, but now we have to expand all tc=name