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>
This commit is contained in:
parent
ea14a41821
commit
12fb31815d
|
@ -3273,20 +3273,21 @@ _XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator,
|
||||||
int *led_return)
|
int *led_return)
|
||||||
{
|
{
|
||||||
XkbIndicatorMapPtr map;
|
XkbIndicatorMapPtr map;
|
||||||
int led;
|
|
||||||
|
|
||||||
/* search for the right indicator */
|
/* search for the right indicator */
|
||||||
map = NULL;
|
map = NULL;
|
||||||
if (sli->names && sli->maps) {
|
if (sli->names && sli->maps) {
|
||||||
|
int led;
|
||||||
|
|
||||||
for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) {
|
for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) {
|
||||||
if (sli->names[led] == indicator) {
|
if (sli->names[led] == indicator) {
|
||||||
map= &sli->maps[led];
|
map= &sli->maps[led];
|
||||||
|
*led_return = led;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*led_return = led;
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue