[Bug 7748] ash: fix a memory leak

bugzilla at busybox.net bugzilla at busybox.net
Tue Nov 20 08:35:10 UTC 2018


https://bugs.busybox.net/show_bug.cgi?id=7748

--- Comment #1 from Yuki Machida <machida.yuki at jp.fujitsu.com> ---
Please merge a patch to upstream of busybox.

Following patch is applied to busybobx 1.29.3.
I confirmed that fix a memory leak.

% diff -uprN busybox-1_29_3/shell/ash.c busybox-1_29_3.mod/shell/ash.c 
--- busybox-1_29_3/shell/ash.c  2018-09-10 03:56:49.000000000 +0900
+++ busybox-1_29_3.mod/shell/ash.c      2018-11-20 17:19:54.412928831 +0900
@@ -9009,6 +9009,7 @@ evaltree(union node *n, int flags)
        int checkexit = 0;
        int (*evalfn)(union node *, int);
        int status = 0;
+       struct stackmark smark;

        if (n == NULL) {
                TRACE(("evaltree(NULL) called\n"));
@@ -9029,6 +9030,7 @@ evaltree(union node *n, int flags)
                status = !evaltree(n->nnot.com, EV_TESTED);
                goto setstatus;
        case NREDIR:
+               setstackmark(&smark);
                errlinno = lineno = n->nredir.linno;
                if (funcline)
                        lineno -= funcline - 1;
@@ -9040,6 +9042,7 @@ evaltree(union node *n, int flags)
                }
                if (n->nredir.redirect)
                        popredir(/*drop:*/ 0);
+               popstackmark(&smark);
                goto setstatus;
        case NCMD:
                evalfn = evalcommand;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list