From: Denys Vlasenko Date: Wed, 26 Jul 2017 17:25:40 +0000 (+0200) Subject: ash: [VAR] Fix poplocalvar leak X-Git-Tag: 1_28_0~305 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d5b500c81c1ec73d2feeea14c2e872726044d9e8;p=oweals%2Fbusybox.git ash: [VAR] Fix poplocalvar leak Upstream commit: Date: Tue, 25 May 2010 18:14:32 +0800 [VAR] Fix poplocalvar leak When a variable is marked as local, we set VSTRFIXED on its vp recored. However, poplocalvar never clears this flag for variables that were unset to begin with. Thus if you ever made an unset variable local, it would get the VSTRFIXED bit and stick around forever. Signed-off-by: Herbert Xu Signed-off-by: Denys Vlasenko --- diff --git a/shell/ash.c b/shell/ash.c index 8bef78546..75a72ea0c 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -9200,7 +9200,8 @@ poplocalvars(void) memcpy(optlist, lvp->text, sizeof(optlist)); free((char*)lvp->text); optschanged(); - } else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) { + } else if (lvp->flags == VUNSET) { + vp->flags &= ~(VSTRFIXED|VREADONLY); unsetvar(vp->var_text); } else { if (vp->var_func)