diff options
| author | christos <christos@NetBSD.org> | 2022-12-02 19:23:15 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2022-12-02 19:23:15 +0000 |
| commit | a76f61463de79fb55af1db5ff83b1f68aeca0073 (patch) | |
| tree | ae3aa12d15b09409675cbf7961147f65a78189e7 /lib/libedit | |
| parent | 3de79feea1982eb1e10c0a3165625b0d0f4c5c32 (diff) | |
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 (limited to 'lib/libedit')
| -rw-r--r-- | lib/libedit/readline.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index d726c415c2c..ef3abd4b6da 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -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 @@ replace_history_entry(int num, const char *line, histdata_t data) 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; |
