From owner-svn-src-all@FreeBSD.ORG Sun Dec 6 22:46:43 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48305106566C; Sun, 6 Dec 2009 22:46:43 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 29F988FC16; Sun, 6 Dec 2009 22:46:41 +0000 (UTC) Received: by bwz5 with SMTP id 5so3097806bwz.3 for ; Sun, 06 Dec 2009 14:46:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=UJNXjvEhdPSKMU8ay+iRYH15SuVY97tVTvjSjEVE7jk=; b=wEw5Hgle9Ayg0VnYggVZ9GeV4kQTGtYLu9u8vCtnm/HBpOcmnhhy+jweYa5QANTzV2 /f8fAQ3iCX0DiJeneHyGwJL6hJt38CAXpoNPzrZXIEA1mF0k88vDAmez9dVObmoiVJgn w3l7G1ukL3A3Th9lGBqhCZfaVWmYbUV7eF1/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=xx2M/IYhsT/1kjqtcgCoss6Ack8OmYXam1jQflunfLmKZaKS2WphVKbi18iu/fYYm9 PyDske0RNCQ+YvW3qOmRu9ec06L+GW8Mh++DsrsQ8QwPeZca/jRjA6BzqH2tyQsK3FaY yhIEQ3cuJf44PpdDYr/CW+nyuNSPz82CaL7Y0= MIME-Version: 1.0 Received: by 10.204.34.10 with SMTP id j10mr3603298bkd.77.1260139601015; Sun, 06 Dec 2009 14:46:41 -0800 (PST) In-Reply-To: <200912062201.nB6M1jsP032883@svn.freebsd.org> References: <200912062201.nB6M1jsP032883@svn.freebsd.org> Date: Sun, 6 Dec 2009 23:46:40 +0100 Message-ID: <6101e8c40912061446s79423b50le51dd7861fdcc333@mail.gmail.com> From: Oliver Pinter To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r200188 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 22:46:43 -0000 this for 7-STABLE? On 12/6/09, Jilles Tjoelker wrote: > Author: jilles > Date: Sun Dec 6 22:01:45 2009 > New Revision: 200188 > URL: http://svn.freebsd.org/changeset/base/200188 > > Log: > MFC r198963: sh: Fix memory leak when using a variable in arithmetic > like $((x)). > > Modified: > stable/8/bin/sh/arith_lex.l > Directory Properties: > stable/8/bin/sh/ (props changed) > > Modified: stable/8/bin/sh/arith_lex.l > ============================================================================== > --- stable/8/bin/sh/arith_lex.l Sun Dec 6 21:42:25 2009 (r200187) > +++ stable/8/bin/sh/arith_lex.l Sun Dec 6 22:01:45 2009 (r200188) > @@ -51,6 +51,13 @@ __FBSDID("$FreeBSD$"); > > int yylex(void); > > +struct varname > +{ > + struct varname *next; > + char name[1]; > +}; > +static struct varname *varnames; > + > #undef YY_INPUT > #define YY_INPUT(buf,result,max) \ > result = (*buf = *arith_buf++) ? 1 : YY_NULL; > @@ -80,11 +87,14 @@ int yylex(void); > * If variable doesn't exist, we should initialize > * it to zero. > */ > - char *temp; > + struct varname *temp; > if (lookupvar(yytext) == NULL) > setvarsafe(yytext, "0", 0); > - temp = (char *)ckmalloc(strlen(yytext) + 1); > - yylval.s_value = strcpy(temp, yytext); > + temp = ckmalloc(sizeof(struct varname) + > + strlen(yytext)); > + temp->next = varnames; > + varnames = temp; > + yylval.s_value = strcpy(temp->name, yytext); > > return ARITH_VAR; > } > @@ -130,5 +140,15 @@ int yylex(void); > void > arith_lex_reset(void) > { > + struct varname *name, *next; > + > YY_NEW_FILE; > + > + name = varnames; > + while (name != NULL) { > + next = name->next; > + ckfree(name); > + name = next; > + } > + varnames = NULL; > } > _______________________________________________ > svn-src-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable > To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" >