diff options
author | Zhang Xiao <xiao.zhang@windriver.com> | 2017-08-25 08:42:38 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-27 22:30:06 +0100 |
commit | e4881a3d22ca055e27aaf8eaacfe1ea2ded79e3d (patch) | |
tree | 79b947f451bcd723ae65c8e1ae133d47374a484e | |
parent | 2f84fb232f972cb1ca2dc9fa3644cc6a509051ae (diff) | |
download | poky-e4881a3d22ca055e27aaf8eaacfe1ea2ded79e3d.tar.gz |
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)
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>
-rw-r--r-- | meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch | 35 | ||||
-rw-r--r-- | meta/recipes-extended/bash/bash_4.4.bb | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch b/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch new file mode 100644 index 0000000000..9fb6ba972b --- /dev/null +++ b/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From d3b6303a6853f612a56848ee4e59eaa0b0ab9489 Mon Sep 17 00:00:00 2001 | ||
2 | From: Zhang Xiao <xiao.zhang@windriver.com> | ||
3 | Date: Tue, 21 Feb 2017 11:30:14 +0800 | ||
4 | Subject: [PATCH] bash: memleak bug fix for builtin command read | ||
5 | |||
6 | Built in command "read" with "-e" use Readline to obtain the line | ||
7 | in an interactive shell. In this process, a string "rlbuf" is | ||
8 | just allocated without free operation thus cause memory leak. Fix it. | ||
9 | |||
10 | Upstream-Status: Submitted [http://lists.gnu.org/archive/html/bug-bash/2017-02/msg00061.html] | ||
11 | |||
12 | Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com> | ||
13 | --- | ||
14 | builtins/read.def | 5 +++++ | ||
15 | 1 file changed, 5 insertions(+) | ||
16 | |||
17 | diff --git a/builtins/read.def b/builtins/read.def | ||
18 | index 4397154..ee0c5a6 100644 | ||
19 | --- a/builtins/read.def | ||
20 | +++ b/builtins/read.def | ||
21 | @@ -674,6 +674,11 @@ add_char: | ||
22 | input_string[i] = '\0'; | ||
23 | CHECK_ALRM; | ||
24 | |||
25 | +#if defined (READLINE) | ||
26 | + if (edit) | ||
27 | + xfree (rlbuf); | ||
28 | +#endif | ||
29 | + | ||
30 | if (retval < 0) | ||
31 | { | ||
32 | t_errno = errno; | ||
33 | -- | ||
34 | 1.9.1 | ||
35 | |||
diff --git a/meta/recipes-extended/bash/bash_4.4.bb b/meta/recipes-extended/bash/bash_4.4.bb index b602afe8ac..e544d07c10 100644 --- a/meta/recipes-extended/bash/bash_4.4.bb +++ b/meta/recipes-extended/bash/bash_4.4.bb | |||
@@ -25,6 +25,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ | |||
25 | file://run-ptest \ | 25 | file://run-ptest \ |
26 | file://fix-run-builtins.patch \ | 26 | file://fix-run-builtins.patch \ |
27 | file://0001-help-fix-printf-format-security-warning.patch \ | 27 | file://0001-help-fix-printf-format-security-warning.patch \ |
28 | file://bash-memleak-bug-fix-for-builtin-command-read.patch \ | ||
28 | " | 29 | " |
29 | 30 | ||
30 | SRC_URI[tarball.md5sum] = "148888a7c95ac23705559b6f477dfe25" | 31 | SRC_URI[tarball.md5sum] = "148888a7c95ac23705559b6f477dfe25" |