diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-01-17 13:02:27 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-01-17 13:02:27 +0100 |
commit | 7c4b13e0190a645f4083741c7803e51984cf71cb (patch) | |
tree | 146ac20f87a9d68767afb7803c45229319e846eb | |
parent | 5d78355d5afcda9a95cb18926317e86f8b14223e (diff) | |
download | busybox-w32-7c4b13e0190a645f4083741c7803e51984cf71cb.tar.gz busybox-w32-7c4b13e0190a645f4083741c7803e51984cf71cb.tar.bz2 busybox-w32-7c4b13e0190a645f4083741c7803e51984cf71cb.zip |
ash: revert wrong "fix" for an apparent memory leak. Closes 5822
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index eb1347447..31fbc550a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -8677,8 +8677,17 @@ expredir(union node *n) | |||
8677 | #if ENABLE_ASH_BASH_COMPAT | 8677 | #if ENABLE_ASH_BASH_COMPAT |
8678 | store_expfname: | 8678 | store_expfname: |
8679 | #endif | 8679 | #endif |
8680 | #if 0 | ||
8681 | // By the design of stack allocator, the loop of this kind: | ||
8682 | // while true; do while true; do break; done </dev/null; done | ||
8683 | // will look like a memory leak: ash plans to free expfname's | ||
8684 | // of "/dev/null" as soon as it finishes running the loop | ||
8685 | // (in this case, never). | ||
8686 | // This "fix" is wrong: | ||
8680 | if (redir->nfile.expfname) | 8687 | if (redir->nfile.expfname) |
8681 | stunalloc(redir->nfile.expfname); | 8688 | stunalloc(redir->nfile.expfname); |
8689 | // It results in corrupted state of stacked allocations. | ||
8690 | #endif | ||
8682 | redir->nfile.expfname = fn.list->text; | 8691 | redir->nfile.expfname = fn.list->text; |
8683 | break; | 8692 | break; |
8684 | case NFROMFD: | 8693 | case NFROMFD: |