Hi Chet and experts, Build in command "read" with "-e" option causes memory leak. Can be reproduced with below script and lots of input data.
$cat script.sh #!/bin/bash/bash while [ 1 ]; do read -e data; echo $data; done $./script.sh The patch at the end of this mail can fix it. Thanks Xiao diff --git a/builtins/read.def b/builtins/read.def index 33821f3..60bdc87 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -690,6 +690,11 @@ add_char: input_string[i] = '\0'; CHECK_ALRM; +#if defined (READLINE) + if (edit) + xfree (rlbuf); +#endif + if (retval < 0) { t_errno = errno;