From owner-freebsd-current@FreeBSD.ORG Tue May 1 07:39:17 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 75E7416A402 for ; Tue, 1 May 2007 07:39:17 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id ECA6D13C483 for ; Tue, 1 May 2007 07:39:16 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.1/8.14.1) with ESMTP id l417d6QD004372; Tue, 1 May 2007 11:39:06 +0400 (MSD) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.14.1/8.14.1/Submit) id l417d5Ig004371; Tue, 1 May 2007 11:39:05 +0400 (MSD) (envelope-from ache) Date: Tue, 1 May 2007 11:39:05 +0400 From: Andrey Chernov To: "Sean C. Farley" Message-ID: <20070501073905.GA4305@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , "Sean C. Farley" , freebsd-current@freebsd.org References: <20070426195122.P37719@thor.farley.org> <20070427122634.GA32237@nagual.pp.ru> <20070430205747.G28846@thor.farley.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070430205747.G28846@thor.farley.org> User-Agent: Mutt/1.5.15 (2007-04-06) Cc: freebsd-current@freebsd.org Subject: Re: setenv memory leak fix (take 3) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2007 07:39:17 -0000 On Mon, Apr 30, 2007 at 09:04:46PM -0500, Sean C. Farley wrote: > 2. http://www.farley.org/freebsd/tmp/setenv-8/POSIX/sysenv.c putenv(): /* Create environment entry. */ envVars[envNdx].name = string; envVars[envNdx].nameLen = nameLen; envVars[envNdx].value = equals + 1; envVars[envNdx].valueSize = valueLen; It will not work that way. "string" is just passed buffer which can be altered any time until the next set|putenv call. It means that you can't assume "nameLen", "equals" position and "valueLen" will stay the same as at the moment of the call. -- http://ache.pp.ru/