diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-07 12:58:57 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-26 09:31:06 +1000 |
commit | c18dd3fd9b2e4bf3862666671042b7c933f64100 (patch) | |
tree | 76cad3572ab1d1a7a1433767f0167c7432f8bffb | |
parent | 0f71be87b9174c587ccacd6aa61a9a66d3507ef4 (diff) |
xkb: don't assign garbage value to led_return.
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 <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit 12fb31815db9de9c01f2d4155a2b74531777c0bf)
-rw-r--r-- | xkb/xkb.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3273,20 +3273,21 @@ _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]; + *led_return = led; break; } } } - *led_return = led; return map; } |