Date: Thu, 27 Mar 2014 22:57:23 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263847 - head/bin/sh Message-ID: <201403272257.s2RMvNg7025856@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Thu Mar 27 22:57:23 2014 New Revision: 263847 URL: http://svnweb.freebsd.org/changeset/base/263847 Log: sh: Fix memory leak with an assignment before a regular builtin. MFC after: 1 week Modified: head/bin/sh/var.c Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Thu Mar 27 22:52:26 2014 (r263846) +++ head/bin/sh/var.c Thu Mar 27 22:57:23 2014 (r263847) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403272257.s2RMvNg7025856>