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

Jesse Barnes jbarnes at virtuousgeek.org
Wed Mar 28 16:54:16 PDT 2007


On Wednesday, March 28, 2007 3:05 pm Magnus Vigerlöf wrote:
> Possible memory leaks, stricter option checks, UnInit introduction
>
> Added more checks on the options, specifically for the driver and
> name/identifier options. Added unwind section to handle fault cases.
>
> +unwind:
> +    if(pInfo) {
> +        if(drv->UnInit)
> +            drv->UnInit(drv, pInfo, 0);
> +        else
> +            xf86DeleteInput(pInfo, 0);
> +    }
> +    if(idev->driver)
> +        xfree(idev->driver);
> +    if(idev->identifier)
> +        xfree(idev->identifier);
> +    xf86optionListFree(idev->commonOptions);
> +    xfree(idev);
> +    return rval;
>  }

I guess xfree can't handle freeing already NULL pointers?  If so it 
could cleanup error paths like this a little.  Looks good though.

Jesse



More information about the xorg mailing list