[vlc-devel] commit: Don't use FREENULL when that's not needed and don' t free NULL just for fun. ( Rémi Duraffort )

Rémi Denis-Courmont rem at videolan.org
Wed Sep 17 20:53:24 CEST 2008


Le mercredi 17 septembre 2008 21:27:19 Bill C. Riemers, vous avez écrit :
> The reason for FREENULL is because not all platforms correctly ignore
> free(NULL).

Hmm no. As noted by several others already, VLC's FREENULL() just frees then 
NULLifies the pointer. Hence, it is mostly useful if the pointer's own 
storage is not freed immediately afterward. It avoids dangling pointers.

> I hope you are certain all the platforms VLC is built on 
> do correctly handle free(NULL).

Such a brain-damaged platform does not deserve to run VLC, and it would be 
trivial to divert the brain-damaged free() to the wrapper.

> For example, applications I have built with unpatched Microsoft Visual
> Studio 6.0 will sometimes crash and do other weird things if the program
> calls free(NULL).  This particular bug was corrected in MVS 6.0 service
> pack 3.

*Fortunately*, VLC cannot be compiled with MSVC 6.

-- 
Rémi Denis-Courmont
http://git.remlab.net/cgi-bin/gitweb.cgi?p=vlc-courmisch.git;a=summary



More information about the vlc-devel mailing list