The branch stable/14 has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2ca3e4673a6db1ec47cca34c96c3c5384e2cde55

commit 2ca3e4673a6db1ec47cca34c96c3c5384e2cde55
Author:     Dag-Erling Smørgrav <[email protected]>
AuthorDate: 2026-05-27 17:02:12 +0000
Commit:     Dag-Erling Smørgrav <[email protected]>
CommitDate: 2026-06-02 16:42:03 +0000

    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
    
    (cherry picked from commit 6880405bf97df03ffce227d34c2faa99b602a49d)
---
 usr.bin/cap_mkdb/cap_mkdb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c
index ff85c14b9b33..a6c958809e7a 100644
--- a/usr.bin/cap_mkdb/cap_mkdb.c
+++ b/usr.bin/cap_mkdb/cap_mkdb.c
@@ -130,6 +130,7 @@ main(int argc, char *argv[])
 
        if (capdbp->close(capdbp) < 0)
                err(1, "%s", capname);
+       free(capname);
        capname = NULL;
        exit(0);
 }
@@ -164,7 +165,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

Reply via email to