[PATCH 2/6] xserver: Possible memory leaks, stricter option checks, UnInit (NewInputDeviceRequest)

Alan Coopersmith alan.coopersmith at sun.com
Fri Mar 30 07:20:22 PDT 2007


Magnus Vigerlöf wrote:
> On Thursday 29 March 2007 04:40, Eric Anholt wrote:
> [...]
>>> I guess xfree can't handle freeing already NULL pointers?  If so it
>>> could cleanup error paths like this a little.  Looks good though.
>> The first thing Xfree (what xfree() is) does is check if the pointer is
>> null and return if so.
> 
> You're right. Xfree (and free as well) does seem to handle this. However many 
> places this check is made in the code anyway, and there's a comment 
> complaining about this 0-pointer check in Xfree as well..

And ANSI C requires free(NULL) to be a safe no-op anyways, so it's not
needed at all on modern OS'es.

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering



More information about the xorg mailing list