aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
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;
}