summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getcap.c
diff options
context:
space:
mode:
authorhoek <hoek@FreeBSD.org>2000-05-21 02:55:09 +0000
committerhoek <hoek@FreeBSD.org>2000-05-21 02:55:09 +0000
commit1043ce86f8ebd724d267ea9fc7af9a8ff30695a6 (patch)
treefe53432c7b6bea55d436a29c7983bd29316062b3 /lib/libc/gen/getcap.c
parenta5b99a6579949ed7d1e9f238d984edb9f11fed05 (diff)
downloadFreeBSD-src-1043ce86f8ebd724d267ea9fc7af9a8ff30695a6.zip
FreeBSD-src-1043ce86f8ebd724d267ea9fc7af9a8ff30695a6.tar.gz
Fix a memory leak in getent() that occurred when the requested entry
could not be found. PR: bin/17084
Diffstat (limited to 'lib/libc/gen/getcap.c')
-rw-r--r--lib/libc/gen/getcap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c
index 4e41a79..b3261ae 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
OpenPOWER on IntegriCloud