cap_mkdb: Fix memory leak

This is not a big deal since it only iterates once before exiting, but
that's no reason to set a bad example.

PR:		195128
MFC after:	1 week
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D57251
This commit is contained in:
Dag-Erling Smørgrav
2026-05-27 19:02:12 +02:00
parent f2a89e7e1d
commit 6880405bf9
+2 -1
View File
@@ -117,6 +117,7 @@ main(int argc, char *argv[])
if (capdbp->close(capdbp) < 0)
err(1, "%s", capname);
free(capname);
capname = NULL;
exit(0);
}
@@ -151,7 +152,7 @@ db_build(char **ifiles)
data.data = NULL;
key.data = NULL;
for (reccnt = 0, bplen = 0; (st = cgetnext(&bp, ifiles)) > 0;) {
for (reccnt = 0, bplen = 0; (st = cgetnext(&bp, ifiles)) > 0; free(bp)) {
/*
* Allocate enough memory to store record, terminating