summaryrefslogtreecommitdiffstats
path: root/bin/sh/var.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/var.c')
-rw-r--r--bin/sh/var.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 6c0685f..da13de7 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -325,8 +325,11 @@ setvareq(char *s, int flags)
mklocal(s);
vp = find_var(s, &vpp, &nlen);
if (vp != NULL) {
- if (vp->flags & VREADONLY)
+ if (vp->flags & VREADONLY) {
+ if ((flags & (VTEXTFIXED|VSTACK)) == 0)
+ ckfree(s);
error("%.*s: is read only", vp->name_len, s);
+ }
if (flags & VNOSET)
return;
INTOFF;
OpenPOWER on IntegriCloud