aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2011-03-08 11:23:45 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2011-03-09 15:23:39 +1000
commit50193a0dd35b6f54499fb76ab68f615237cc51f9 (patch)
tree9f073dca13f24a1d7ca9227113bf76ab00960f91 /src
parentUse Absolute/Relative as argument to xf86Post* (diff)
downloadxf86-input-evdev-50193a0dd35b6f54499fb76ab68f615237cc51f9.tar.gz
xf86-input-evdev-50193a0dd35b6f54499fb76ab68f615237cc51f9.tar.bz2
xf86-input-evdev-50193a0dd35b6f54499fb76ab68f615237cc51f9.zip
Release leaked XKB options on input device disconnect.
Currently the XKB options duplicated in EvdevAddKeyClass are never released. For example, connecting and disconnecting a bluetooth keyboard repeatedly causes a steadily growing memory leak. Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 519a50e..679df38 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1826,6 +1826,18 @@ EvdevOpenDevice(InputInfoPtr pInfo)
return Success;
}
+static void
+EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+{
+ EvdevPtr pEvdev = pInfo ? pInfo->private : NULL;
+ if (pEvdev)
+ {
+ /* Release strings allocated in EvdevAddKeyClass. */
+ XkbFreeRMLVOSet(&pEvdev->rmlvo, FALSE);
+ }
+ xf86DeleteInput(pInfo, flags);
+}
+
static int
EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
{
@@ -1897,7 +1909,7 @@ _X_EXPORT InputDriverRec EVDEV = {
"evdev",
NULL,
EvdevPreInit,
- NULL,
+ EvdevUnInit,
NULL,
evdevDefaults
};