sh: Fix memory leak when trying to set a read only variable.
MFC after: 1 week
This commit is contained in:
parent
cf321a51b1
commit
89d4f883a4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=263846
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user