Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit Don't free getline memory (Ingo Schwarze).



details:   https://anonhg.NetBSD.org/src/rev/54cbe423c5c4
branches:  trunk
changeset: 343590:54cbe423c5c4
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 15 21:35:52 2016 +0000

description:
Don't free getline memory (Ingo Schwarze).

diffstat:

 lib/libedit/history.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 84b5c5125437 -r 54cbe423c5c4 lib/libedit/history.c
--- a/lib/libedit/history.c     Mon Feb 15 20:58:02 2016 +0000
+++ b/lib/libedit/history.c     Mon Feb 15 21:35:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: history.c,v 1.50 2016/02/15 15:53:45 christos Exp $    */
+/*     $NetBSD: history.c,v 1.51 2016/02/15 21:35:52 christos Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.50 2016/02/15 15:53:45 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.51 2016/02/15 21:35:52 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -756,7 +756,6 @@
        ptr = h_malloc((max_size = 1024) * sizeof(*ptr));
        if (ptr == NULL)
                goto done;
-       free(line);
        for (i = 0; (sz = getline(&line, &llen, fp)) != -1; i++) {
                if (sz > 0 && line[sz - 1] == '\n')
                        line[--sz] = '\0';
@@ -775,7 +774,6 @@
                        i = -1;
                        goto oomem;
                }
-               free(line);
        }
 oomem:
        h_free(ptr);



Home | Main Index | Thread Index | Old Index