As the comment for the function states, led_return is undefined if map is NULL. We might as well skip writing to it then.
Found by clang. Reported-by: Tomas Carnecky <[email protected]> Signed-off-by: Peter Hutterer <[email protected]> --- xkb/xkb.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index 00ae29c..57bf5de 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -3273,20 +3273,22 @@ _XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator, int *led_return) { XkbIndicatorMapPtr map; - int led; /* search for the right indicator */ map = NULL; if (sli->names && sli->maps) { + int led; + for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) { if (sli->names[led] == indicator) { map= &sli->maps[led]; break; } } + + *led_return = led; } - *led_return = led; return map; } -- 1.6.5.2 _______________________________________________ xorg-devel mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-devel
