malloc without check in libads
Andrew Bartlett
abartlet at pcug.org.au
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'
somthing.
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 pcug.org.au
Manager, Authentication Subsystems, Samba Team abartlet at samba.org
Student Network Administrator, Hawker College abartlet at hawkerc.net
http://samba.org http://build.samba.org http://hawkerc.net
More information about the samba-technical
mailing list