summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-08-12 12:05:47 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-09-20 16:08:30 +0200
commitd27a6708b00256d5ccccebfe38bb01cfdca8ec04 (patch)
tree3e057d614c88875f34137c0fcee1e28544c7c398
parent2cf6022100c97ee71df08e84efcc9a743f36544c (diff)
downloadspice-d27a6708b00256d5ccccebfe38bb01cfdca8ec04.tar.gz
spice-d27a6708b00256d5ccccebfe38bb01cfdca8ec04.tar.xz
spice-d27a6708b00256d5ccccebfe38bb01cfdca8ec04.zip
fix 2 X11 related leaks
-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 1facf736..2adc160d 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -2958,6 +2958,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 d53a92f2..cfc10c5e 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -1306,16 +1306,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;