summaryrefslogtreecommitdiff
authorPeter Hutterer <peter.hutterer@who-t.net>2009-09-23 01:43:27 (GMT)
committer Peter Hutterer <peter.hutterer@who-t.net>2009-09-24 22:17:03 (GMT)
commita9c274df5c37cb4ece6449e934342d8ff8e61705 (patch) (side-by-side diff)
tree4ece210923feed50e6fb63674ed21f2072b55702
parentfd913136732ff14a0484ca28f60ac1fbf49be81d (diff)
downloadxserver-a9c274df5c37cb4ece6449e934342d8ff8e61705.zip
xserver-a9c274df5c37cb4ece6449e934342d8ff8e61705.tar.gz
kdrive: plug two memory leaks when freeing the KdKeyboard/Pointer.
xkbRules, xkbModel and xkbLayout are strdup'd in KdNewKeyboard, need to be freed. The ephyr driver strdups the name on top of the already allocated kdrive-assigned name. Memory must be freed beforehand. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--hw/kdrive/ephyr/ephyr.c4
-rw-r--r--hw/kdrive/src/kinfo.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 296284a..254fcbc 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -1074,6 +1074,8 @@ MouseInit (KdPointerInfo *pi)
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
pi->nAxes = 3;
pi->nButtons = 32;
+ if (pi->name)
+ xfree(pi->name);
pi->name = strdup("Xephyr virtual mouse");
ephyrMouse = pi;
return Success;
@@ -1123,6 +1125,8 @@ EphyrKeyboardInit (KdKeyboardInfo *ki)
}
ki->minScanCode = ephyrKeySyms.minKeyCode;
ki->maxScanCode = ephyrKeySyms.maxKeyCode;
+ if (ki->name)
+ xfree(ki->name);
ki->name = strdup("Xephyr virtual keyboard");
ephyrKbd = ki;
return Success;
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index cb64613..4551fd7 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -166,6 +166,12 @@ KdFreeKeyboard(KdKeyboardInfo *ki)
xfree(ki->name);
if (ki->path)
xfree(ki->path);
+ if (ki->xkbRules)
+ xfree(ki->xkbRules);
+ if (ki->xkbModel)
+ xfree(ki->xkbModel);
+ if (ki->xkbLayout)
+ xfree(ki->xkbLayout);
ki->next = NULL;
xfree(ki);
}