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.23 (requested b...



details:   https://anonhg.NetBSD.org/src/rev/4d15ac582375
branches:  netbsd-1-5
changeset: 490602:4d15ac582375
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 03 20:43:48 2001 +0000

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

diffstat:

 libexec/lfs_cleanerd/cleanerd.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r 82327e414623 -r 4d15ac582375 libexec/lfs_cleanerd/cleanerd.c
--- a/libexec/lfs_cleanerd/cleanerd.c   Sat Feb 03 20:37:17 2001 +0000
+++ b/libexec/lfs_cleanerd/cleanerd.c   Sat Feb 03 20:43:48 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cleanerd.c,v 1.18.4.2 2000/09/14 18:53:19 perseant Exp $       */
+/*     $NetBSD: cleanerd.c,v 1.18.4.3 2001/02/03 20:43:48 he Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)cleanerd.c 8.5 (Berkeley) 6/10/95";
 #else
-__RCSID("$NetBSD: cleanerd.c,v 1.18.4.2 2000/09/14 18:53:19 perseant Exp $");
+__RCSID("$NetBSD: cleanerd.c,v 1.18.4.3 2001/02/03 20:43:48 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -544,6 +544,10 @@
                                               sp->sl_id);
                        }
                }
+               if (sbp->buf)
+                       free(sbp->buf);
+               if (sbp->segs)
+                       free(sbp->segs);
                free(sbp);
        }
        free(segs);
@@ -660,6 +664,7 @@
        sp = SEGUSE_ENTRY(lfsp, fsp->fi_segusep, id);
        seg_addr = sntoda(lfsp,id);
        error = 0;
+       tba = NULL;
 
         syslog(LOG_DEBUG, "adding segment %d: contains %lu bytes", id,
                    (unsigned long)sp->su_nbytes);
@@ -787,10 +792,13 @@
        memcpy(sbp->ba + sbp->nb, tba, num_blocks * sizeof(BLOCK_INFO));
        sbp->nb += num_blocks;
 
+       free(tba);
        return (0);
 
     out:
        --sbp->nsegs;
+       if (tba)
+               free(tba);
        if (sbp->ba)
                free(sbp->ba);
        if (error) {



Home | Main Index | Thread Index | Old Index