Source-Changes-HG archive

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

[src/netbsd-1-5]: src/libexec/lfs_cleanerd Pull up revision 1.17 (requested b...



details:   https://anonhg.NetBSD.org/src/rev/6d1857d7456e
branches:  netbsd-1-5
changeset: 490603:6d1857d7456e
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 03 20:44:03 2001 +0000

description:
Pull up revision 1.17 (requested by perseant):
  Plug memory leak in lfs_cleanerd.  Fixes PR#11094.

diffstat:

 libexec/lfs_cleanerd/library.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r 4d15ac582375 -r 6d1857d7456e libexec/lfs_cleanerd/library.c
--- a/libexec/lfs_cleanerd/library.c    Sat Feb 03 20:43:48 2001 +0000
+++ b/libexec/lfs_cleanerd/library.c    Sat Feb 03 20:44:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: library.c,v 1.15.4.1 2000/09/14 18:53:19 perseant Exp $        */
+/*     $NetBSD: library.c,v 1.15.4.2 2001/02/03 20:44:03 he Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)library.c  8.3 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: library.c,v 1.15.4.1 2000/09/14 18:53:19 perseant Exp $");
+__RCSID("$NetBSD: library.c,v 1.15.4.2 2001/02/03 20:44:03 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -353,6 +353,7 @@
        int nelem, nblocks, nsegs, sumsize, i, ssize;
 
        i = 0;
+       bip = NULL;
        lfsp = &fsp->fi_lfs;
        nelem = 2 * lfsp->lfs_ssize;
        if (!(bip = malloc(nelem * sizeof(BLOCK_INFO))))
@@ -375,9 +376,7 @@
                if (nblocks <= 0) {
                         syslog(LOG_DEBUG, "Warning: invalid segment summary at 0x%x",
                            pseg_addr);
-                       *bcount = 0;
-                       return -1;
-                       /* break; */
+                       goto err0;
                }
 
 #ifdef DIAGNOSTIC
@@ -427,7 +426,10 @@
        *blocks = bip;
        return (0);
 
-err0:  *bcount = 0;
+    err0:
+       if (bip)
+               free(bip);
+       *bcount = 0;
        return (-1);
 
 }



Home | Main Index | Thread Index | Old Index