Date: Thu, 6 Aug 1998 14:48:09 -0500 (EST) From: Alfred Perlstein <bright@hotjobs.com> To: Narvi <narvi@haldjas.folklore.ee> Cc: freebsd-current@FreeBSD.ORG Subject: Re: memory leaks in libc Message-ID: <Pine.BSF.3.96.980806144722.28112B-100000@bright.ny.otec.com> In-Reply-To: <Pine.BSF.3.96.980806152019.9173B-100000@haldjas.folklore.ee>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980806144722.28112B-100000>