Module Name: src Committed By: christos Date: Fri Dec 2 19:23:16 UTC 2022
Modified Files: src/lib/libedit: readline.c Log Message: 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) To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/lib/libedit/readline.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/readline.c diff -u src/lib/libedit/readline.c:1.177 src/lib/libedit/readline.c:1.178 --- src/lib/libedit/readline.c:1.177 Sun Oct 30 15:11:31 2022 +++ src/lib/libedit/readline.c Fri Dec 2 14:23:15 2022 @@ -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 cha 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;