On Mon, Jan 31, 2011 at 12:03:32PM +0200, Erkki Seppälä wrote: > Release modifiermap before returning. Reordered code to call > XGetModifierMapping after the first return from the function. > > Signed-off-by: Erkki Seppälä <[email protected]> > > diff --git a/modules/im/ximcp/imThaiFlt.c b/modules/im/ximcp/imThaiFlt.c > index e0b3988..e2b0458 100644 > --- a/modules/im/ximcp/imThaiFlt.c > +++ b/modules/im/ximcp/imThaiFlt.c > @@ -1262,15 +1262,20 @@ 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); > + > 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; > } > > -- > 1.7.0.4 >
Reviewed-by: Dirk Wallenstein <[email protected]> A related thing. XGetModifierMapping can return NULL. I would suggest to just return 0 in that case. -- Greetings, Dirk _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
