[PATCH xserver 1/3] xkb: Ensure that XKB device private won't leak on device disconnect.

Rami Ylimäki rami.ylimaki at vincit.fi
Fri Mar 4 07:55:31 PST 2011


Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
---
 xkb/xkbActions.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index c020444..a29aeb7 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -67,20 +67,13 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
 Bool
 XkbInitPrivates(void)
 {
-    return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
+    return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, sizeof(xkbDeviceInfoRec));
 }
 
 void
 XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
 {
-    xkbDeviceInfoPtr xkbPrivPtr;
-
-    xkbPrivPtr = (xkbDeviceInfoPtr) calloc(1, sizeof(xkbDeviceInfoRec));
-    if (!xkbPrivPtr)
-	return;
-    xkbPrivPtr->unwrapProc = NULL;
-
-    dixSetPrivate(&device->devPrivates, xkbDevicePrivateKey, xkbPrivPtr);
+    xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
     WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc);
 }
 
-- 
1.6.3.3



More information about the xorg-devel mailing list