summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2010-01-04 18:21:54 -0800
committerKeith Packard <keithp@keithp.com>2010-01-04 18:48:18 -0800
commit13c8bd3fde3b0831921e59f84936022a16379d63 (patch)
tree099dfe148525b9f11ff704c1a4e9e5d62c963e45
parente707612e9de4e5e1d91dc1a8152810912d7e18bb (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>
-rw-r--r--dix/devices.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 6329d2810..92b95ed69 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -842,6 +842,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;
@@ -853,9 +856,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);