Date: Fri, 7 Aug 1998 14:55:12 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: drosih@rpi.edu (Garance A Drosihn) Cc: wollman@khavrinen.lcs.mit.edu, freebsd-current@FreeBSD.ORG Subject: Re: memory leaks in libc Message-ID: <199808072155.OAA05409@bubba.whistle.com> In-Reply-To: <v04011702b1f10c76c658@[128.113.24.47]> from Garance A Drosihn at "Aug 7, 98 04:39:37 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808072155.OAA05409>