summaryrefslogtreecommitdiff
path: root/xkb/xkb.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-12-07 12:58:57 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-12-11 11:37:37 +1000
commit12fb31815db9de9c01f2d4155a2b74531777c0bf (patch)
tree4293ec16dc0a71b1fa67303f093157c2da389c98 /xkb/xkb.c
parentea14a418214ba4c58910f5650d8b25b3fc3a7099 (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>
Diffstat (limited to 'xkb/xkb.c')
-rw-r--r--xkb/xkb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 00ae29cd7..35f8d1cbd 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -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;
}