diff options
author | Pauli Nieminen <ext-pauli.nieminen@nokia.com> | 2010-07-26 14:50:30 +0300 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-09-01 14:43:02 +1000 |
commit | d6642de7ebdda16e0056600a86a7802bd4c393b7 (patch) | |
tree | 494732c0f1d7e6378750e32d2ac3d4dff5289f80 /xkb | |
parent | adc0697cfcfba295a15d7a307125093cbccd637f (diff) |
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>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbLEDs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index f617537cf..16826713e 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -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; } |