Skip to content

Commit

Permalink
xkb: don't assign garbage value to led_return.
Browse files Browse the repository at this point in the history
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]>
Reviewed-by: Jamey Sharp <[email protected]>
  • Loading branch information
whot committed Dec 11, 2009
1 parent ea14a41 commit 12fb318
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xkb/xkb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 12fb318

Please sign in to comment.