[PATCH 2/6] xserver: Possible memory leaks, stricter option checks, UnInit (NewInputDeviceRequest)
Eirik Byrkjeflot Anonsen
eirik at opera.com
Fri Mar 30 10:18:10 PDT 2007
Alan Coopersmith <alan.coopersmith at sun.com> writes:
> 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
> And ANSI C requires free(NULL) to be a safe no-op anyways, so it's not
> needed at all on modern OS'es.
But I don't think xfree(NULL) is guaranteed to be safe. And I doubt
that xfree(NULL) is specified as being "as safe as" free(NULL).
More information about the xorg