Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/systat oops, avoid duplicate free().



details:   https://anonhg.NetBSD.org/src/rev/d66ef21057a7
branches:  trunk
changeset: 480289:d66ef21057a7
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Jan 08 23:34:17 2000 +0000

description:
oops, avoid duplicate free().

diffstat:

 usr.bin/systat/globalcmds.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 742560cb915a -r d66ef21057a7 usr.bin/systat/globalcmds.c
--- a/usr.bin/systat/globalcmds.c       Sat Jan 08 23:12:36 2000 +0000
+++ b/usr.bin/systat/globalcmds.c       Sat Jan 08 23:34:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: globalcmds.c,v 1.6 2000/01/08 23:12:37 itojun Exp $ */
+/*     $NetBSD: globalcmds.c,v 1.7 2000/01/08 23:34:17 itojun Exp $ */
 
 /*-
  * Copyright (c) 1999
@@ -81,6 +81,7 @@
                        continue;
                if (cur && prev && strcmp(cur, prev) == 0) {
                        free(cur);
+                       cur = NULL;
                        continue;
                }
                len = strlen(cur);
@@ -92,10 +93,14 @@
                if (prev)
                        free(prev);
                prev = cur;
+               cur = NULL;
        }
        if (col == 0 && args) {
                standout();
-               addstr("help: no matches");
+               if (strlen(args) < COLS - 25)
+                       printw("help: no matches for `%s.*'", args);
+               else
+                       printw("help: no matches");
                standend();
        }
        clrtoeol();



Home | Main Index | Thread Index | Old Index