From d6642de7ebdda16e0056600a86a7802bd4c393b7 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Mon, 26 Jul 2010 14:50:30 +0300 Subject: 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 Reviewed-by: Peter Hutterer --- xkb/xkbLEDs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xkb') 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; } -- cgit v1.2.3