Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/cap_mkdb db_build(): fix memory leak, free() the buf...



details:   https://anonhg.NetBSD.org/src/rev/aa19cd53fbe8
branches:  trunk
changeset: 503002:aa19cd53fbe8
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Jan 28 17:34:31 2001 +0000

description:
db_build(): fix memory leak, free() the buffer allocated by cgetnext() on
        every loop iteration

diffstat:

 usr.bin/cap_mkdb/cap_mkdb.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 187c649bc2e5 -r aa19cd53fbe8 usr.bin/cap_mkdb/cap_mkdb.c
--- a/usr.bin/cap_mkdb/cap_mkdb.c       Sun Jan 28 17:17:56 2001 +0000
+++ b/usr.bin/cap_mkdb/cap_mkdb.c       Sun Jan 28 17:34:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cap_mkdb.c,v 1.12 2000/10/04 20:02:26 mjl Exp $        */
+/*     $NetBSD: cap_mkdb.c,v 1.13 2001/01/28 17:34:31 jdolecek Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
 #endif
-__RCSID("$NetBSD: cap_mkdb.c,v 1.12 2000/10/04 20:02:26 mjl Exp $");
+__RCSID("$NetBSD: cap_mkdb.c,v 1.13 2001/01/28 17:34:31 jdolecek Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -168,7 +168,7 @@
 
        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



Home | Main Index | Thread Index | Old Index