Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/top/machine Avoid duplicate free() while reading sys...



details:   https://anonhg.NetBSD.org/src/rev/d6212fbfc33e
branches:  trunk
changeset: 474127:d6212fbfc33e
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 28 22:13:04 1999 +0000

description:
Avoid duplicate free() while reading system information.
Fixes PR bin/7873 by Mason Loring Bliss.

diffstat:

 usr.bin/top/machine/m_netbsd13.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r db6f203a71cf -r d6212fbfc33e usr.bin/top/machine/m_netbsd13.c
--- a/usr.bin/top/machine/m_netbsd13.c  Mon Jun 28 21:48:13 1999 +0000
+++ b/usr.bin/top/machine/m_netbsd13.c  Mon Jun 28 22:13:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: m_netbsd13.c,v 1.4 1999/04/12 06:02:27 ross Exp $      */
+/*     $NetBSD: m_netbsd13.c,v 1.5 1999/06/28 22:13:04 tron Exp $      */
 
 /*
  * top - a top users display for Unix
@@ -34,7 +34,7 @@
  *             matthew green <mrg%eterna.com.au@localhost>
  *
  *
- * $Id: m_netbsd13.c,v 1.4 1999/04/12 06:02:27 ross Exp $
+ * $Id: m_netbsd13.c,v 1.5 1999/06/28 22:13:04 tron Exp $
  */
 #define UVM
 
@@ -405,8 +405,10 @@
        memory_stats[5] = dbtob(totalsize) / 1024 - memory_stats[4];
        /*  Free here, before we malloc again in the next
         *  iteration of this loop.  */
-       if (seporig)
+       if (seporig) {
                free(seporig);
+               seporig = NULL;
+       }
     } while (0);
     /*  Catch the case where we malloc'd, but then exited the
      *  loop due to nswap != rnswap.  */



Home | Main Index | Thread Index | Old Index