Date: Tue, 15 Apr 2014 18:24:25 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r264512 - stable/10/bin/sh Message-ID: <201404151824.s3FIOPgl068230@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Tue Apr 15 18:24:24 2014 New Revision: 264512 URL: http://svnweb.freebsd.org/changeset/base/264512 Log: MFC r263846: sh: Fix memory leak when trying to set a read only variable. 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 17:52:22 2014 (r264511) +++ stable/10/bin/sh/var.c Tue Apr 15 18:24:24 2014 (r264512) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404151824.s3FIOPgl068230>