mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
1 changed files with 4 additions and 1 deletions
|
|
@ -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 a new issue