aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorErkki Seppälä <erkki.seppala@vincit.fi>2011-01-10 16:22:45 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:26 +0200
commite4815126b5f0befca091fe7c9ce40477ef1d5f19 (patch)
tree77ee19a38e647a13e3993ac7d24ccca6da6049a5 /nx-X11
parent018d938aa3aea8bd30bd07736bd4107aa6fda996 (diff)
downloadnx-libs-e4815126b5f0befca091fe7c9ce40477ef1d5f19.tar.gz
nx-libs-e4815126b5f0befca091fe7c9ce40477ef1d5f19.tar.bz2
nx-libs-e4815126b5f0befca091fe7c9ce40477ef1d5f19.zip
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: Erkki Seppälä <erkki.seppala@vincit.fi> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/lib/X11/imThaiFlt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/nx-X11/lib/X11/imThaiFlt.c b/nx-X11/lib/X11/imThaiFlt.c
index 5f67373d1..72f6f2e7a 100644
--- a/nx-X11/lib/X11/imThaiFlt.c
+++ b/nx-X11/lib/X11/imThaiFlt.c
@@ -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;
}