Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install/delete Close some memory leaks.



details:   https://anonhg.NetBSD.org/src/rev/c8e059a303b6
branches:  trunk
changeset: 512764:c8e059a303b6
user:      wiz <wiz%NetBSD.org@localhost>
date:      Mon Jul 16 13:50:41 2001 +0000

description:
Close some memory leaks.
Reported (incl. patch) by YAMAMOTO Takashi in pkg/12830.

diffstat:

 usr.sbin/pkg_install/delete/perform.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r e44a4ed30f88 -r c8e059a303b6 usr.sbin/pkg_install/delete/perform.c
--- a/usr.sbin/pkg_install/delete/perform.c     Mon Jul 16 13:50:21 2001 +0000
+++ b/usr.sbin/pkg_install/delete/perform.c     Mon Jul 16 13:50:41 2001 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.32 2001/03/04 18:16:43 hubertf Exp $     */
+/*     $NetBSD: perform.c,v 1.33 2001/07/16 13:50:41 wiz Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.32 2001/03/04 18:16:43 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.33 2001/07/16 13:50:41 wiz Exp $");
 #endif
 #endif
 
@@ -384,8 +384,10 @@
                        TAILQ_INSERT_TAIL(&reqq, lpp, lp_link);
 
                        lpp2 = find_on_queue(&lpdelq, p->name);
-                       if (lpp2)
+                       if (lpp2) {
                                TAILQ_REMOVE(&lpdelq, lpp2, lp_link);
+                               free_lpkg(lpp2);
+                       }
                        lpp = alloc_lpkg(p->name);
                        TAILQ_INSERT_TAIL(&lpdelq, lpp, lp_link);
 
@@ -446,6 +448,7 @@
                p = find_plist(&rPlist, PLIST_CWD);
                if (!p) {
                        warnx("package '%s' doesn't have a prefix", lpp->lp_name);
+                       free_plist(&rPlist);
                        fail = 1;
                        goto fail;
                }
@@ -454,6 +457,7 @@
                TAILQ_INSERT_HEAD(&lpfindq, thislpp, lp_link);
 
                rc = require_find_recursive_down(lpp, &rPlist);
+               free_plist(&rPlist);
                if (rc) {
                        fail = 1;
                        goto fail;



Home | Main Index | Thread Index | Old Index