sh: Fix memory leak with an assignment before a regular builtin.
MFC after: 1 week
This commit is contained in:
parent
89d4f883a4
commit
d73dba75d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=263847
10
bin/sh/var.c
10
bin/sh/var.c
@ -330,8 +330,11 @@ setvareq(char *s, int flags)
|
||||
ckfree(s);
|
||||
error("%.*s: is read only", vp->name_len, s);
|
||||
}
|
||||
if (flags & VNOSET)
|
||||
if (flags & VNOSET) {
|
||||
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
|
||||
ckfree(s);
|
||||
return;
|
||||
}
|
||||
INTOFF;
|
||||
|
||||
if (vp->func && (flags & VNOFUNC) == 0)
|
||||
@ -364,8 +367,11 @@ setvareq(char *s, int flags)
|
||||
return;
|
||||
}
|
||||
/* not found */
|
||||
if (flags & VNOSET)
|
||||
if (flags & VNOSET) {
|
||||
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
|
||||
ckfree(s);
|
||||
return;
|
||||
}
|
||||
INTOFF;
|
||||
vp = ckmalloc(sizeof (*vp));
|
||||
vp->flags = flags;
|
||||
|
Loading…
Reference in New Issue
Block a user