summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2010-01-04 18:21:54 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2010-01-05 09:40:39 -0800
commit8661189c2c443e2d3e5d98e6b04d1852a98bac41 (patch)
tree95b62a464fdaff94573ed0895e050c47ba5f3366
parentd1320f4f2908fd3a248a79314bd78f76b03c71c5 (diff)
CloseDevice: call XkbRemoveResourceClient before freeing key class struct
XkbRemoveResourceClient() returns immediately if dev->key is NULL. CloseDevice calls XkbRemoveResourceClient until it removes all resources. If we free dev->key and NULL it before XkbRemoveResourceClient, then infinite loop ensues, and the server appears to hang on exit or crash. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 13c8bd3fde3b0831921e59f84936022a16379d63)
-rw-r--r--dix/devices.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dix/devices.c b/dix/devices.c
index e3fd456d4..245a95b0f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -843,6 +843,9 @@ CloseDevice(DeviceIntPtr dev)
if(dev->valuator && dev->valuator->accelScheme.AccelCleanupProc)
dev->valuator->accelScheme.AccelCleanupProc(dev);
+ while (dev->xkb_interest)
+ XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
+
xfree(dev->name);
classes = (ClassesPtr)&dev->key;
@@ -854,9 +857,6 @@ CloseDevice(DeviceIntPtr dev)
FreeAllDeviceClasses(classes);
}
- while (dev->xkb_interest)
- XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
-
if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
xfree(dev->spriteInfo->sprite->spriteTrace);
xfree(dev->spriteInfo->sprite);