From da67ab4db2d16072e03259de77d670bba419e918 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 11 Mar 2024 20:02:12 +0000 Subject: [PATCH] Pull up following revision(s) (requested by ozaki-r in ticket #1816): lib/libc/gen/getcap.c: revision 1.58 Fix memory leak in getent() Memory was not freed if record was not found --- lib/libc/gen/getcap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index b63694ecb88d..3b0c5f42a115 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -1,4 +1,4 @@ -/* $NetBSD: getcap.c,v 1.57 2017/06/18 03:56:39 manu Exp $ */ +/* $NetBSD: getcap.c,v 1.57.8.1 2024/03/11 20:02:12 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.57 2017/06/18 03:56:39 manu Exp $"); +__RCSID("$NetBSD: getcap.c,v 1.57.8.1 2024/03/11 20:02:12 martin Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -502,8 +502,10 @@ getent(char **cap, size_t *len, const char * const *db_array, int fd, break; } - if (!foundit) + if (!foundit) { + free(record); return -1; + } /* * Got the capability record, but now we have to expand all tc=name