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

Jesse Barnes jbarnes at virtuousgeek.org
Thu Mar 29 17:32:57 PDT 2007


On Thursday, March 29, 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..
>
> Where do we want to have this check?

I think having it in free/xfree is nicer, since it can make error path code 
a little nicer.  Better one conditional in free/xfree than dozens all over 
the tree.

Jesse



More information about the xorg mailing list