svn commit: r264513 - stable/10/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Tue Apr 15 18:29:06 UTC 2014
Author: jilles
Date: Tue Apr 15 18:29:05 2014
New Revision: 264513
URL: http://svnweb.freebsd.org/changeset/base/264513
Log:
MFC r263847: sh: Fix memory leak with an assignment before a regular builtin
Modified:
stable/10/bin/sh/var.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/bin/sh/var.c
==============================================================================
--- stable/10/bin/sh/var.c Tue Apr 15 18:24:24 2014 (r264512)
+++ stable/10/bin/sh/var.c Tue Apr 15 18:29:05 2014 (r264513)
@@ -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;
More information about the svn-src-stable-10
mailing list