Subject: Re: libssh2 master e48907e... avoid a free(NULL)

Re: libssh2 master e48907e... avoid a free(NULL)

From: Mikhail Gusarov <dottedmag_at_dottedmag.net>
Date: Sun, 10 Jan 2010 05:21:29 +0600

Twas brillig at 00:05:21 10.01.2010 UTC+01 when daniel_at_haxx.se did gyre and gimble:

 DS> 1 - aesthetics. I think calling the callback function to free something when
 DS> we know there's nothing to free is useless.

OTOH, double-checking memory for NULL (one call outside of free(3) and
another one inside) is a bit slower.

 DS> 2 - this triggered a problem in a debug setup of libssh2 that I use,
 DS> that happen to have a trigger on free(NULL) to catch mistakes in the code

I'd call this setup broken, as lot of code relies on the fact free(NULL) = NOP.

-- 
  http://fossarchy.blogspot.com/

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2010-01-10