Commit e4815126 authored by Erkki Seppälä's avatar Erkki Seppälä Committed by Ulrich Sibiller

im/ximcp: release modifiermap before returning

Variable "map" goes out of scope Release modifiermap before returning. Reordered code to call XGetModifierMapping after the first return from the function. Signed-off-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi> Reviewed-by: 's avatarDirk Wallenstein <halsmit@t-online.de> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 018d938a
......@@ -1262,15 +1262,22 @@ Private unsigned
NumLockMask(Display *d)
{
int i;
XModifierKeymap *map = XGetModifierMapping (d);
XModifierKeymap *map;
KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock);
if (numlock_keycode == NoSymbol)
return 0;
map = XGetModifierMapping (d);
if (!map)
return 0;
for (i = 0; i < 8; i++) {
if (map->modifiermap[map->max_keypermod * i] == numlock_keycode)
if (map->modifiermap[map->max_keypermod * i] == numlock_keycode) {
XFreeModifiermap(map);
return 1 << i;
}
}
XFreeModifiermap(map);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment