[git commit] ash: fix a memory leak

Denys Vlasenko vda.linux at googlemail.com
Tue Nov 13 18:26:53 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=4ba6c5d3ba3d2c7922aff6b5c2e73b8325f1cf17
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

The script which triggers the leak:

while true
  do
    while true
      do
        break;
    done</dev/null
done

Signed-off-by: Jon Tollefson <kniht at linux.vnet.ibm.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index 010924d..dda18e8 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8676,6 +8676,8 @@ expredir(union node *n)
 #if ENABLE_ASH_BASH_COMPAT
  store_expfname:
 #endif
+			if (redir->nfile.expfname)
+				stunalloc(redir->nfile.expfname);
 			redir->nfile.expfname = fn.list->text;
 			break;
 		case NFROMFD:


More information about the busybox-cvs mailing list