From owner-freebsd-current Fri Aug 7 14:56:09 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA03259 for freebsd-current-outgoing; Fri, 7 Aug 1998 14:56:09 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA03197 for ; Fri, 7 Aug 1998 14:55:44 -0700 (PDT) (envelope-from archie@whistle.com) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id OAA09380; Fri, 7 Aug 1998 14:55:24 -0700 (PDT) Received: from bubba.whistle.com(207.76.205.7) by whistle.com via smap (V1.3) id sma009378; Fri Aug 7 14:55:13 1998 Received: (from archie@localhost) by bubba.whistle.com (8.8.7/8.6.12) id OAA05409; Fri, 7 Aug 1998 14:55:13 -0700 (PDT) From: Archie Cobbs Message-Id: <199808072155.OAA05409@bubba.whistle.com> Subject: Re: memory leaks in libc In-Reply-To: from Garance A Drosihn at "Aug 7, 98 04:39:37 pm" To: drosih@rpi.edu (Garance A Drosihn) Date: Fri, 7 Aug 1998 14:55:12 -0700 (PDT) Cc: wollman@khavrinen.lcs.mit.edu, freebsd-current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Garance A Drosihn writes: > setenv("NAME","VAL1"); -> does a malloc to store NAME > keep = getenv("NAME"); -> returns a pointer to the middle > of that malloc'ed area > setenv("NAME","VAL2"); -> replaces the value of NAME as > is kept in the environment > if ( ! strcmp(keep, "VAL1") ) { do_stuff(); } Yes, I think we can boil it down to this. If you call this a perfectly valid program, then we should not fix the memory leak. If you call this a bug not worth accomodating, then we should fix the memory leak. NB: with today's libc, keep will be equal to "VAL2" on the last line! Isn't there a POSIX spec for getenv()/putenv()... what does it say? -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message