[PATCH 3/4] dix: fix pixmap leak on server reset

Brendan King Brendan.King at imgtec.com
Wed Jun 4 02:05:17 PDT 2014


Sorry for the delay in replying.

Without the patch in place,  screen->DeviceCursorCleanup was never being called, as dev->spriteInfo->sprite was NULL for every device. DisableDevice is called before CloseDevice, and DisableDevice will call FreeSprite if the device is enabled, which will set dev->spriteInfo->sprite to NULL.

The important part of the patch is the removal of the test for dev->spriteInfo->sprite before calling screen->DeviceCursorCleanup, which ensures the latter gets called.

The call to FreeSprite doesn't have to be moved. I moved it because the original code had the comment "free sprite memory" before the call to screen->DeviceCursorCleanup, yet the call to FreeSprite was sometime later. It seemed a good idea to replace the comment with the actual call to FreeSprite.

________________________________________
From: Keith Packard [keithp at keithp.com]
Sent: 23 May 2014 01:09
To: Frank Binns; xorg-devel at lists.x.org
Cc: Rufus Hamade; Frank Binns; Brendan King
Subject: Re: [PATCH 3/4] dix: fix pixmap leak on server reset

Frank Binns <frank.binns at imgtec.com> writes:

> index ab923d5..a5bbe23 100644
> --- a/dix/devices.c
> +++ b/dix/devices.c
> @@ -946,8 +946,9 @@ CloseDevice(DeviceIntPtr dev)
>      if (dev->inited)
>          (void) (*dev->deviceProc) (dev, DEVICE_CLOSE);
>
> -    /* free sprite memory */
> -    if (IsMaster(dev) && dev->spriteInfo->sprite)
> +    FreeSprite(dev);
> +
> +    if (IsMaster(dev))
>          screen->DeviceCursorCleanup(dev, screen);

Can you explain how this helps? From what I can see, you're simply
removing the check for dev->spriteInfo->sprite, which is necessary only
because you've freed the sprite before checking.

>
>      /* free acceleration info */
> @@ -968,8 +969,6 @@ CloseDevice(DeviceIntPtr dev)
>          free(classes);
>      }
>
> -    FreeSprite(dev);
> -
>      /* a client may have the device set as client pointer */
>      for (j = 0; j < currentMaxClients; j++) {
>          if (clients[j] && clients[j]->clientPtr == dev) {

--
keith.packard at intel.com


More information about the xorg-devel mailing list