summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko2013-01-17 13:02:27 +0100
committerDenys Vlasenko2013-01-17 13:02:27 +0100
commit7c4b13e0190a645f4083741c7803e51984cf71cb (patch)
tree146ac20f87a9d68767afb7803c45229319e846eb /shell
parent5d78355d5afcda9a95cb18926317e86f8b14223e (diff)
downloadbusybox-7c4b13e0190a645f4083741c7803e51984cf71cb.zip
busybox-7c4b13e0190a645f4083741c7803e51984cf71cb.tar.gz
ash: revert wrong "fix" for an apparent memory leak. Closes 5822
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index eb13474..31fbc55 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8677,8 +8677,17 @@ expredir(union node *n)
#if ENABLE_ASH_BASH_COMPAT
store_expfname:
#endif
+#if 0
+// By the design of stack allocator, the loop of this kind:
+// while true; do while true; do break; done </dev/null; done
+// will look like a memory leak: ash plans to free expfname's
+// of "/dev/null" as soon as it finishes running the loop
+// (in this case, never).
+// This "fix" is wrong:
if (redir->nfile.expfname)
stunalloc(redir->nfile.expfname);
+// It results in corrupted state of stacked allocations.
+#endif
redir->nfile.expfname = fn.list->text;
break;
case NFROMFD: