From b993d73bb3214ecc24646f5427c8003b816c6921 Mon Sep 17 00:00:00 2001 From: Erkki Seppälä Date: Mon, 10 Jan 2011 16:22:45 +0200 Subject: im/ximcp: release modifiermap before returning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Reviewed-by: Dirk Wallenstein --- modules/im/ximcp/imThaiFlt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'modules/im/ximcp') 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; } -- cgit v1.2.3