From 8187dd1c8b6354eae10dff8c4fc69d5908402cc8 Mon Sep 17 00:00:00 2001 From: Tim Vanderhoek Date: Sun, 21 May 2000 02:55:09 +0000 Subject: [PATCH] Fix a memory leak in getent() that occurred when the requested entry could not be found. PR: bin/17084 --- lib/libc/gen/getcap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index 4e41a7967a39..b3261aeb54ae 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -382,8 +382,10 @@ getent(cap, len, db_array, fd, name, depth, nfield) break; } - if (!foundit) + if (!foundit) { + free(record); return (-1); + } /* * Got the capability record, but now we have to expand all tc=name