Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 1997 10:15:05 +0200 (SAT)
From:      Graham Wheeler <gram@cdsec.com>
To:        tlambert@primenet.com (Terry Lambert)
Cc:        hackers@freebsd.org
Subject:   Re: Bug in malloc/free (was: Memory leak in getservbyXXX?)
Message-ID:  <199709190815.KAA01865@cdsec.com>
In-Reply-To: <199709182114.OAA13613@usr03.primenet.com> from "Terry Lambert" at Sep 18, 97 09:14:40 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> How about:
> 
> 	heap_ptr p = malloc( 20);
> 	heap_ptr q, r;
> 	free(p);
> 	q = malloc(10)
> 	r = malloc( 10);
> 	free(p);
> 
> ? 8-).

Well, in this case q is typically equal to p. So the call to free(p) is
not a heap error (even though it is logically an error). 
Would one call this a `Godel error'? ;-)

If you add a line afterwards of the form `free(q);', then of course this
added line is detected:

    Bad call to free from file gwtest.c, line 33
    Possibly freed before at gwtest.c, line 32, size 10


-- 
Dr Graham Wheeler                          E-mail: gram@cdsec.com
Citadel Data Security                      Phone:  +27(21)23-6065/6/7
Internet/Intranet Network Specialists      Mobile: +27(83)-253-9864
Firewalls/Virtual Private Networks         Fax:    +27(21)24-3656
Data Security Products                     WWW:    http://www.cdsec.com/






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