[PATCH:mouse] Plug minor memory leak.

Alan Coopersmith Alan.Coopersmith at Sun.COM
Mon Dec 7 08:17:46 PST 2009


Looks good to me.

Reviewed-by: Alan Coopersmith <alan.coopersmith at sun.com>

Peter Hutterer wrote:
> This change splits the DEVICE_CLOSE behaviour from the DEVICE_OFF behaviour.
> This doesn't change functionality as the server guarantees DEVICE_OFF to be
> called first and DEVICE_CLOSE thus becomes a noop anyway.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/mouse.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mouse.c b/src/mouse.c
> index 8347be9..7571aeb 100644
> --- a/src/mouse.c
> +++ b/src/mouse.c
> @@ -1709,7 +1709,6 @@ MouseProc(DeviceIntPtr device, int what)
>  	break;
>  	    
>      case DEVICE_OFF:
> -    case DEVICE_CLOSE:
>  	if (pInfo->fd != -1) {
>  	    xf86RemoveEnabledDevice(pInfo);
>  	    if (pMse->buffer) {
> @@ -1727,6 +1726,10 @@ MouseProc(DeviceIntPtr device, int what)
>  	}
>  	device->public.on = FALSE;
>  	break;
> +    case DEVICE_CLOSE:
> +	xfree(pMse->mousePriv);
> +	pMse->mousePriv = NULL;
> +	break;
>      }
>      return Success;
>  }

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



More information about the xorg-devel mailing list