Put the XkbSrvLedInfoRec allocation in front of the subsequent
branching, and ensure a non-NULL pointer to the new record in a third
branch that was missing that allocation.

Signed-off-by: Dirk Wallenstein <[email protected]>
---
This is one item in the recent parfait results.

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

diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 6097f85..3a9d307 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -521,12 +521,12 @@ XkbSrvLedInfoPtr  sli;
 Bool                   checkAccel;
 Bool                   checkNames;
 
-    sli= NULL;
+    sli= calloc(1, sizeof(XkbSrvLedInfoRec));
+    if (sli==NULL)
+        return NULL; /* ALLOCATION ERROR */
     checkAccel= checkNames= FALSE;
     if ((kf!=NULL)&&(kf->xkb_sli==NULL)) {
-       kf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec));
-       if (sli==NULL)
-           return NULL; /* ALLOCATION ERROR */
+       kf->xkb_sli= sli;
        if (dev->key && dev->key->xkbInfo)
             sli->flags= XkbSLI_HasOwnState;
        else sli->flags= 0;     
@@ -567,9 +567,7 @@ Bool                        checkNames;
        }
     }
     else if ((lf!=NULL)&&(lf->xkb_sli==NULL)) {
-       lf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec));
-       if (sli==NULL)
-           return NULL; /* ALLOCATION ERROR */
+       lf->xkb_sli= sli;
        if (dev->key && dev->key->xkbInfo)
             sli->flags= XkbSLI_HasOwnState;
        else sli->flags= 0;     
-- 
1.7.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to