Source-Changes-HG archive

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

[src/netbsd-1-5]: src/lib/libcurses pullup 1.30 -> 1.31 (approved by releng-1-5)



details:   https://anonhg.NetBSD.org/src/rev/0a2cd400870b
branches:  netbsd-1-5
changeset: 488859:0a2cd400870b
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Aug 03 11:40:01 2000 +0000

description:
pullup 1.30 -> 1.31 (approved by releng-1-5)

 > free region got from t_getstr().  we will experience memory leak if
 > we call initscr() multiple times (rare, but it's better to be pedant).

diffstat:

 lib/libcurses/getch.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 5faa0cf8e741 -r 0a2cd400870b lib/libcurses/getch.c
--- a/lib/libcurses/getch.c     Thu Aug 03 11:38:26 2000 +0000
+++ b/lib/libcurses/getch.c     Thu Aug 03 11:40:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getch.c,v 1.29.4.1 2000/08/03 11:38:26 itojun Exp $    */
+/*     $NetBSD: getch.c,v 1.29.4.2 2000/08/03 11:40:01 itojun Exp $    */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)getch.c    8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: getch.c,v 1.29.4.1 2000/08/03 11:38:26 itojun Exp $");
+__RCSID("$NetBSD: getch.c,v 1.29.4.2 2000/08/03 11:40:01 itojun Exp $");
 #endif
 #endif                                 /* not lint */
 
@@ -379,6 +379,7 @@
        size_t limit;
        key_entry_t *tmp_key;
        keymap_t *current;
+       char *cp;
 #ifdef DEBUG
        int k;
 #endif
@@ -396,7 +397,9 @@
        for (i = 0; i < num_tcs; i++) {
                p = entry;
                limit = 1023;
-               if (t_getstr(_cursesi_genbuf, tc[i].name, &p, &limit) != NULL) {
+               cp = t_getstr(_cursesi_genbuf, tc[i].name, &p, &limit);
+               if (cp != NULL) {
+                       free(cp);
                        current = base_keymap;  /* always start with
                                                 * base keymap. */
                        length = (int) strlen(entry);



Home | Main Index | Thread Index | Old Index