[PATCH v2] xkb: Fix NULL pointer dereference in XkbAllocSrvLedInfo

Dirk Wallenstein halsmit at t-online.de
Sat Jun 5 11:18:47 PDT 2010

The second branch is an extension of the first, where the only
assignment of an XkbSLI_IsDefault flag takes place. That flag says that
the maps and names fields are pointers into xkbInfo->desc and not to
memory allocated with the XkbSrvLedInfoRec.
There is no allocation necessary in the second branch, and the only task
is to update the relation to xkbInfo->desc.
To accomplish that, the XkbSrvLedInfoPtr from the keyboard feedback has
to be used.

Signed-off-by: Dirk Wallenstein <halsmit at t-online.de>
This is one item in the recent parfait results.

 xkb/xkbLEDs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 6097f85..0a01679 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -556,6 +556,7 @@ Bool			checkNames;
     else if ((kf!=NULL)&&((kf->xkb_sli->flags&XkbSLI_IsDefault)!=0)) {
 	XkbDescPtr	xkb;
 	xkb= dev->key->xkbInfo->desc;
+	sli= kf->xkb_sli;
 	sli->physIndicators=	xkb->indicators->phys_indicators;
 	if (xkb->names->indicators!=sli->names) {
 	    checkNames= TRUE;

More information about the xorg-devel mailing list