summaryrefslogtreecommitdiffstats
path: root/client/x11
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-08-12 12:05:47 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-08-15 11:22:56 +0200
commit0d4bd55042391d7cbbc9f21725aba02e50174d5b (patch)
tree1edf4b6df8d7c9ffefbd6bec8150e016b3537ba5 /client/x11
parentd7d0a3a98ef24a7be944c54c278f04c59a60974b (diff)
downloadspice-0d4bd55042391d7cbbc9f21725aba02e50174d5b.tar.gz
spice-0d4bd55042391d7cbbc9f21725aba02e50174d5b.tar.xz
spice-0d4bd55042391d7cbbc9f21725aba02e50174d5b.zip
fix 2 X11 related leaks
Diffstat (limited to 'client/x11')
-rw-r--r--client/x11/platform.cpp1
-rw-r--r--client/x11/red_window.cpp11
2 files changed, 8 insertions, 4 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index fe98eae9..09ca61d0 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -2961,6 +2961,7 @@ static unsigned int get_modifier_mask(KeySym modifier)
XModifierKeymap* map = XGetModifierMapping(x_display);
KeyCode keycode = XKeysymToKeycode(x_display, modifier);
if (keycode == NoSymbol) {
+ XFreeModifiermap(map);
return 0;
}
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 9f4da602..2e98ae25 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -1309,16 +1309,19 @@ void RedWindow_p::move_to_current_desktop()
unsigned long nitems_return;
unsigned char *prop_return;
long desktop = ~long(0);
+ int status;
XLockDisplay(x_display);
- if (XGetWindowProperty(x_display, root, wm_current_desktop, 0, 1, False, AnyPropertyType,
- &actual_type_return, &actual_format_return, &nitems_return,
- &bytes_after_return, &prop_return) == Success &&
- actual_type_return != None && actual_format_return == 32) {
+ status = XGetWindowProperty(x_display, root, wm_current_desktop, 0, 1, False, AnyPropertyType,
+ &actual_type_return, &actual_format_return, &nitems_return,
+ &bytes_after_return, &prop_return);
+ if ((status == Success) && (actual_type_return != None) && (actual_format_return == 32)) {
desktop = *(uint32_t *)prop_return;
} else {
DBG(0, "get current desktop failed");
}
+ if (status == Success)
+ XFree(prop_return);
XUnlockDisplay(x_display);
XEvent xevent;