malloc without check in libads

Andrew Bartlett abartlet at
Mon Jan 14 14:52:09 GMT 2002

Claudia Moroder wrote:
> Hi,
> what about to forbid free with a macro like sprintf is forbidden ?
> Bye
> Andreas

Becouse there are times when it is perfectly acceptable to 'free'

In fact, SAFE_FREE() often just hides problems that are more serious -
at least we notice segfaults...

As such the programmer should decide if this pointer being NULL is a
valid condition:  If this can happen in the normal course of code
execution, then fine, but if it "can't" happen then I would suggest just
leaving it alone.

Likewise, the setting to null of a pointer after free is all well and
good, but its only any use if the variable still hangs around - many
'free()' statements are in the last few lines of a function, with the
variable just about to go out of scope.

Andrew Bartlett

Andrew Bartlett                                 abartlet at
Manager, Authentication Subsystems, Samba Team  abartlet at
Student Network Administrator, Hawker College   abartlet at

More information about the samba-technical mailing list