[PATCH 02/32] [libx11] Variable "map" goes out of scope

Dirk Wallenstein halsmit at t-online.de
Thu Jan 27 07:20:02 PST 2011


On Thu, Jan 27, 2011 at 09:53:45AM +0200, Erkki Seppälä wrote:
> Release modifiermap before returning
> 
> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> ---
>  modules/im/ximcp/imThaiFlt.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/modules/im/ximcp/imThaiFlt.c b/modules/im/ximcp/imThaiFlt.c
> index e0b3988..ca8c601 100644
> --- a/modules/im/ximcp/imThaiFlt.c
> +++ b/modules/im/ximcp/imThaiFlt.c
> @@ -1268,9 +1268,12 @@ NumLockMask(Display *d)
>          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;
>  }
>  
> -- 
> 1.7.0.4
> 

The first return is still not covered.  Maybe relocate the
XGetModifierMapping call, or refactor to have one return value.

-- 
Greetings,
Dirk


More information about the xorg-devel mailing list