svn commit: r264644 - stable/9/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Fri Apr 18 12:42:51 UTC 2014
Author: jilles
Date: Fri Apr 18 12:42:50 2014
New Revision: 264644
URL: http://svnweb.freebsd.org/changeset/base/264644
Log:
MFC r263847: sh: Fix memory leak with an assignment before a regular builtin
Modified:
stable/9/bin/sh/var.c
Directory Properties:
stable/9/bin/sh/ (props changed)
Modified: stable/9/bin/sh/var.c
==============================================================================
--- stable/9/bin/sh/var.c Fri Apr 18 12:34:10 2014 (r264643)
+++ stable/9/bin/sh/var.c Fri Apr 18 12:42:50 2014 (r264644)
@@ -344,8 +344,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)
@@ -378,8 +381,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-9
mailing list