Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit PR/57095: Yilei Yang: Change readline's replace_...



details:   https://anonhg.NetBSD.org/src/rev/7f25d165374d
branches:  trunk
changeset: 372493:7f25d165374d
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 02 19:23:15 2022 +0000

description:
PR/57095: Yilei Yang: Change readline's replace_history_entry to not make a copy
of the string to replace since H_REPLACE already makes a copy (fixes memory leak)

diffstat:

 lib/libedit/readline.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r fe6c05f0a2ea -r 7f25d165374d lib/libedit/readline.c
--- a/lib/libedit/readline.c    Thu Dec 01 22:57:37 2022 +0000
+++ b/lib/libedit/readline.c    Fri Dec 02 19:23:15 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.177 2022/10/30 19:11:31 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.177 2022/10/30 19:11:31 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -1606,7 +1606,7 @@
        if (history(h, &ev, H_NEXT_EVDATA, num, &he->data))
                goto out;
 
-       he->line = strdup(ev.str);
+       he->line = ev.str;
        if (he->line == NULL)
                goto out;
 



Home | Main Index | Thread Index | Old Index