xkb: Fix possible NULL pointer dereference

If search for device failed sli is NULL. In that case we have to protect
dereference to prevent server crash.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Pauli Nieminen 2010-07-26 14:50:30 +03:00 committed by Peter Hutterer
parent adc0697cfc
commit d6642de7eb

View File

@ -714,10 +714,12 @@ XkbSrvLedInfoPtr sli;
}
}
}
if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
sli->names= calloc(XkbNumIndicators, sizeof(Atom));
if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
if (sli) {
if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
sli->names= calloc(XkbNumIndicators, sizeof(Atom));
if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
}
return sli;
}