busybox/bugfix-memleak.patch

28 lines
753 B
Diff
Raw Normal View History

diff -urN old/shell/ash.c new/shell/ash.c
--- old/shell/ash.c 2018-11-06 21:47:50.000000000 +0800
+++ new/shell/ash.c 2018-11-06 21:55:43.337608907 +0800
@@ -9011,6 +9011,7 @@
int checkexit = 0;
int (*evalfn)(union node *, int);
int status = 0;
+ struct stackmark smark;
if (n == NULL) {
TRACE(("evaltree(NULL) called\n"));
@@ -9031,6 +9032,7 @@
status = !evaltree(n->nnot.com, EV_TESTED);
goto setstatus;
case NREDIR:
+ setstackmark(&smark);
expredir(n->nredir.redirect);
pushredir(n->nredir.redirect);
status = redirectsafe(n->nredir.redirect, REDIR_PUSH);
@@ -9042,6 +9044,7 @@
}
if (n->nredir.redirect)
popredir(/*drop:*/ 0);
+ popstackmark(&smark);
goto setstatus;
case NCMD:
evalfn = evalcommand;