[PATCH] xserver: input device valuator memory leak

Magnus Vigerlöf Magnus.Vigerlof at home.se
Mon Apr 9 14:02:24 PDT 2007


Free the memory allocated for motion history when removing the input device.
--
Daniel, if you haven't processed my previous patches, please
consider adding this one to that batch as well.

Thanks for your hard work.
 Magnus V
--
diff --git a/dix/devices.c b/dix/devices.c
index c976df0..3e8503e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -443,8 +443,12 @@ #endif
 	xfree(dev->key);
     }
 
-    if (dev->valuator)
+    if (dev->valuator) {
+        /* biggest hack ever 2 (see ~ line 841) */
+        if(dev->valuator->motion && dev->valuator->GetMotionProc == GetMotionHistory)
+            xfree(dev->valuator->motion);
         xfree(dev->valuator);
+    }
 
     if (dev->button) {
 #ifdef XKB



More information about the xorg mailing list