[ldns-users] ldns_buffer_free() function bug?
    W.C.A. Wijngaards 
    wouter at NLnetLabs.nl
       
    Mon Sep  6 14:18:07 UTC 2010
    
    
  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Zbynek,
The prototype is fine, this is what a *free() function is expected to
be.  The LDNS_FREE macro sets its argument to NULL for debugging and
cleanliness reasons, so that use-after-free is detected very quickly.
It is not necessary to change the prototype for ldns_buffer_free for
that, nor is it really necessary to set this variable to NULL.
Best regards,
   Wouter
On 08/26/2010 11:04 AM, Zbynek Michl wrote:
> Hi,
> 
> I have a question about ldns_buffer_free() function. Its prototype is
> 
>   void ldns_buffer_free(ldns_buffer *buffer);
> 
> but shouldn't it be
> 
>   void ldns_buffer_free(ldns_buffer **buffer);
> 
> (pointer to pointer)?
> 
> Because using LDNS_FREE macro only memory is freed, but original pointer
> passed to the function remains at its original address (is not set to
> NULL). Currently only local copy of that pointer is set to NULL.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkyE+B8ACgkQkDLqNwOhpPhNJwCdFPtSl0z1CoeCW5oz4tsr6Qx+
y2wAmwVvUg/QM8AXOq4lYD7HY9pH3Vab
=f6Ie
-----END PGP SIGNATURE-----
    
    
More information about the ldns-users
mailing list