svn commit: samba r14257 - in trunk/source/passdb: .

Jeremy Allison jra at samba.org
Mon Mar 13 00:35:25 GMT 2006


On Mon, Mar 13, 2006 at 11:29:10AM +1100, Andrew Bartlett wrote:
> 
> talloc_free() (and indeed free(), no most platforms) of NULL is a valid
> no-op.

That's not the point of TALLOC_FREE or SAFE_FREE. The point of
them is to ensure that the pointer being freed ends up as NULL
after the call. You can't do this in the _free call itself, it
has to be a wrapper around it or pass in a pointer to the pointer
(ugly:-).

The bugs happen when you call free() or talloc_free() and forget
to set the pointer to null and it gets reused without realizing
it's been freed. It happens....

Using the wrappers mean you get an immediate core dump there.

Jeremy.


More information about the samba-technical mailing list