Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 1997 21:14:40 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        gram@cdsec.com (Graham Wheeler)
Cc:        phk@critter.freebsd.dk, gram@gram.cdsec.com, hackers@FreeBSD.ORG
Subject:   Re: Bug in malloc/free (was: Memory leak in getservbyXXX?)
Message-ID:  <199709182114.OAA13613@usr03.primenet.com>
In-Reply-To: <199709181722.TAA00606@cdsec.com> from "Graham Wheeler" at Sep 18, 97 07:22:10 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Well, then maybe you'll find the code below useful. It isn't Purify, but
> then it doesn't cost anything near the price 8-).  I'd use it
> myself now, except that these days I write everything in C++. Mostly I'm
> happy about that, but not right now...

You can replace you "new" and "delete" functions; you knew that, right?


[ ... ]

> --------- gwtest.c ------------------------------------------------------

[ ... ]

> void doubleFreeTest(void)
> {
>     heap_ptr p = malloc(10);
>     free(p);
>     free(p);
> }

How about:

	heap_ptr p = malloc( 20);
	heap_ptr q, r;
	free(p);
	q = malloc(10)
	r = malloc( 10);
	free(p);

? 8-).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709182114.OAA13613>