From owner-freebsd-current Thu Aug 6 11:47:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA28352 for freebsd-current-outgoing; Thu, 6 Aug 1998 11:47:44 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from bright.ny.otec.com (bright.ny.otec.com [209.3.16.125]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA28300 for ; Thu, 6 Aug 1998 11:47:36 -0700 (PDT) (envelope-from bright@hotjobs.com) Received: from localhost (bright@localhost) by bright.ny.otec.com (8.8.8/8.8.8) with SMTP id OAA28205; Thu, 6 Aug 1998 14:48:09 -0500 (EST) (envelope-from bright@hotjobs.com) X-Authentication-Warning: bright.ny.otec.com: bright owned process doing -bs Date: Thu, 6 Aug 1998 14:48:09 -0500 (EST) From: Alfred Perlstein X-Sender: bright@bright.ny.otec.com To: Narvi cc: freebsd-current@FreeBSD.ORG Subject: Re: memory leaks in libc In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG why not build up a list of which pointers were malloc'd instead of that icky hack? -Alfred Perlstein -- Programmer @ HotJobs Inc. [- http://www.hotjobs.com/ -] |-- There are operating systems, and then there's BSD. \-- http://www.freebsd.org/ On Thu, 6 Aug 1998, Narvi wrote: > > On Thu, 6 Aug 1998, Bruce Evans wrote: > > > > The problem with fixing setenv() is that you don't know if a pointer was > > >malloced, allocated from the env area above the stack, points to read-only > > >text, points to a static data buffer, etc. There really is no way to know > > >for sure, so you can't free the memory. > > > > Yo can know if you malloced it in a previous call to putenv() or setenv(). > > > > Bruce > > So we could: > > a) allocate a bit more memory than needed > b) set the environment string > c) end it with zero > d) append a certain token after the end of the string saying "ok > to free() me" to anyone knowing what to look at? > > But couldn't a string end at the end of allocated area so that by peeking > behind the final zero we will sometimes cause a SIGSEV? > > Sander > > There is no love, no good, no happiness and no future - > all these are just illusions. > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message