diff options
author | Erkki Seppälä <erkki.seppala@vincit.fi> | 2011-01-10 16:22:45 +0200 |
---|---|---|
committer | Erkki Seppälä <erkki.seppala@vincit.fi> | 2011-03-11 12:38:08 +0200 |
commit | b993d73bb3214ecc24646f5427c8003b816c6921 (patch) | |
tree | a8f30fe0ef05306a32039a5ea5ca259e04147503 /modules/im/ximcp | |
parent | 807a7fc0354f2212dfa5ff1f9e4ede56d8e69ef4 (diff) |
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>
Diffstat (limited to 'modules/im/ximcp')
-rw-r--r-- | modules/im/ximcp/imThaiFlt.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/im/ximcp/imThaiFlt.c b/modules/im/ximcp/imThaiFlt.c index e0b3988..12e3de2 100644 --- a/modules/im/ximcp/imThaiFlt.c +++ b/modules/im/ximcp/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; } |