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