Source-Changes-HG archive

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

[src/trunk]: src/usr.bin Fix memory leak.



details:   https://anonhg.NetBSD.org/src/rev/0f65d83ece69
branches:  trunk
changeset: 783299:0f65d83ece69
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Dec 14 08:15:44 2012 +0000

description:
Fix memory leak.

diffstat:

 usr.bin/netstat/bpf.c |  3 ++-
 usr.bin/sed/compile.c |  5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 69f2ea4edf48 -r 0f65d83ece69 usr.bin/netstat/bpf.c
--- a/usr.bin/netstat/bpf.c     Fri Dec 14 05:29:28 2012 +0000
+++ b/usr.bin/netstat/bpf.c     Fri Dec 14 08:15:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.c,v 1.10 2010/12/13 21:15:30 pooka Exp $   */
+/*     $NetBSD: bpf.c,v 1.11 2012/12/14 08:15:44 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -167,6 +167,7 @@
                                printf("%s\n", p.p_comm);
 #undef BPFEXT
                }
+               free(v);
        } else {
                 /* XXX */
                 errx(1, "bpf_dump not implemented using kvm");
diff -r 69f2ea4edf48 -r 0f65d83ece69 usr.bin/sed/compile.c
--- a/usr.bin/sed/compile.c     Fri Dec 14 05:29:28 2012 +0000
+++ b/usr.bin/sed/compile.c     Fri Dec 14 08:15:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compile.c,v 1.37 2010/02/19 16:35:27 tnn Exp $ */
+/*     $NetBSD: compile.c,v 1.38 2012/12/14 08:16:51 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -76,7 +76,7 @@
 #if 0
 static char sccsid[] = "@(#)compile.c  8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: compile.c,v 1.37 2010/02/19 16:35:27 tnn Exp $");
+__RCSID("$NetBSD: compile.c,v 1.38 2012/12/14 08:16:51 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -474,6 +474,7 @@
                err(COMPILE, "RE error: %s", strregerror(eval, *repp));
        if (maxnsub < (*repp)->re_nsub)
                maxnsub = (*repp)->re_nsub;
+       free(re);
        return (p);
 }
 



Home | Main Index | Thread Index | Old Index