fix 2 X11 related leaks

This commit is contained in:
Christophe Fergeau 2011-08-12 12:05:47 +02:00
parent 2cf6022100
commit d27a6708b0
2 changed files with 8 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;