bash: memleak bug fix for builtin command read
Built in command "read" with "-e" use Readline to obtain the line in an interactive shell. In this process, a string "rlbuf" is just allocated without free operation thus cause memory leak. This patch had been submitted to upstream: http://lists.gnu.org/archive/html/bug-bash/2017-02/msg00061.html (From OE-Core rev: a2b278a6eaa9e9b48d858e3be6712267c0122598) (From OE-Core rev: 571e53024b4f924e50cf6a478ccc8d6f097816bb) Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com> Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> fixup for 4.3 Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
d2b60efe20
commit
08f8bf817b
|
@ -0,0 +1,35 @@
|
||||||
|
From d3b6303a6853f612a56848ee4e59eaa0b0ab9489 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhang Xiao <xiao.zhang@windriver.com>
|
||||||
|
Date: Tue, 21 Feb 2017 11:30:14 +0800
|
||||||
|
Subject: [PATCH] bash: memleak bug fix for builtin command read
|
||||||
|
|
||||||
|
Built in command "read" with "-e" use Readline to obtain the line
|
||||||
|
in an interactive shell. In this process, a string "rlbuf" is
|
||||||
|
just allocated without free operation thus cause memory leak. Fix it.
|
||||||
|
|
||||||
|
Upstream-Status: Submitted [http://lists.gnu.org/archive/html/bug-bash/2017-02/msg00061.html]
|
||||||
|
|
||||||
|
Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
|
||||||
|
---
|
||||||
|
builtins/read.def | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/builtins/read.def b/builtins/read.def
|
||||||
|
index 4397154..ee0c5a6 100644
|
||||||
|
--- a/builtins/read.def
|
||||||
|
+++ b/builtins/read.def
|
||||||
|
@@ -674,6 +674,11 @@ add_char:
|
||||||
|
input_string[i] = '\0';
|
||||||
|
CHECK_ALRM;
|
||||||
|
|
||||||
|
+#if defined (READLINE)
|
||||||
|
+ if (edit)
|
||||||
|
+ xfree (rlbuf);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if (retval < 0)
|
||||||
|
{
|
||||||
|
t_errno = errno;
|
||||||
|
--
|
||||||
|
1.9.1
|
||||||
|
|
|
@ -32,6 +32,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \
|
||||||
file://0001-help-fix-printf-format-security-warning.patch \
|
file://0001-help-fix-printf-format-security-warning.patch \
|
||||||
file://fix-run-intl.patch \
|
file://fix-run-intl.patch \
|
||||||
file://CVE-2016-9401.patch \
|
file://CVE-2016-9401.patch \
|
||||||
|
file://bash-memleak-bug-fix-for-builtin-command-read.patch \
|
||||||
"
|
"
|
||||||
|
|
||||||
SRC_URI[tarball.md5sum] = "a27b3ee9be83bd3ba448c0ff52b28447"
|
SRC_URI[tarball.md5sum] = "a27b3ee9be83bd3ba448c0ff52b28447"
|
||||||
|
|
Loading…
Reference in New Issue