xserver: Branch 'mpx' - 7 commits

Peter Hutterer whot at kemper.freedesktop.org
Fri Jan 4 00:14:58 PST 2008


 Xi/chaccess.c    |   49 +++++++------------
 Xi/chdevcur.c    |   18 +++----
 Xi/chpkpair.c    |  137 -------------------------------------------------------
 Xi/extgrbdev.c   |   24 ++++-----
 Xi/fakedevdata.c |    9 +--
 Xi/qryacces.c    |   14 ++---
 Xi/setcptr.c     |   30 ++++--------
 Xi/warpdevp.c    |   24 ++++-----
 Xi/xiselev.c     |    9 +--
 dix/devices.c    |    9 +--
 xfixes/cursor.c  |    6 +-
 11 files changed, 77 insertions(+), 252 deletions(-)

New commits:
commit 249b9b30c11e03bb113b37cf4712bf88debf6f05
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Jan 4 13:49:48 2008 +1030

    Xi: remove file for the obsolete ChangePointerKeyboardPairing request handling.

diff --git a/Xi/chpkpair.c b/Xi/chpkpair.c
deleted file mode 100644
index c44a263..0000000
--- a/Xi/chpkpair.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-
-Copyright 2006 Peter Hutterer <peter at cs.unisa.edu.au>
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the author shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from the author.
-
-*/
-
-/***********************************************************************
- *
- * Request change pairing between pointer and keyboard device.
- *
- */
-
-#define	 NEED_EVENTS
-#define	 NEED_REPLIES
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>	/* for inputstr.h    */
-#include <X11/Xproto.h>	/* Request macro     */
-#include "inputstr.h"	/* DeviceIntPtr      */
-#include "windowstr.h"	/* window structure  */
-#include "scrnintstr.h"	/* screen structure  */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XInput.h>
-#include <X11/extensions/XIproto.h>
-#include <X11/extensions/geproto.h>
-#include "extnsionst.h"
-#include "extinit.h"	/* LookupDeviceIntRec */
-#include "exevents.h"
-#include "exglobals.h"
-#include "geext.h"
-
-
-#include "chpkpair.h"
-
-/***********************************************************************
- *
- * This procedure allows a client to change the pairing of a pointer with a
- * a keyboard.
- *
- */
-
-int SProcXChangePointerKeyboardPairing(ClientPtr client)
-{
-    char n;
-
-    REQUEST(xChangePointerKeyboardPairingReq);
-    swaps(&stuff->length, n);
-    return (ProcXChangePointerKeyboardPairing(client));
-}
-
-int
-ProcXChangePointerKeyboardPairing(ClientPtr client)
-{
-    DeviceIntPtr pPointer, pKeyboard;
-    int ret;
-    pairingChangedNotify ev;
-
-    REQUEST(xChangePointerKeyboardPairingReq);
-    REQUEST_SIZE_MATCH(xChangePointerKeyboardPairingReq);
-
-    /* check if client is registered */
-
-    pPointer = LookupDeviceIntRec(stuff->pointer);
-    if (pPointer == NULL)
-    {
-        SendErrorToClient(client, IReqCode, X_ChangePointerKeyboardPairing,
-                stuff->pointer, BadDevice);
-        return Success;
-    }
-
-    pKeyboard = LookupDeviceIntRec(stuff->keyboard);
-    if (pKeyboard == NULL)
-    {
-        SendErrorToClient(client, IReqCode, X_ChangePointerKeyboardPairing,
-                stuff->keyboard, BadDevice);
-        return Success;
-    }
-
-    ret = PairDevices(client, pPointer, pKeyboard);
-    if (ret != Success)
-    {
-        SendErrorToClient(client, IReqCode, X_ChangePointerKeyboardPairing,
-                0, ret);
-        return Success;
-    }
-
-
-    memset(&ev, 0, sizeof(pairingChangedNotify));
-    GEInitEvent(GEV(&ev), IReqCode);
-    ev.evtype = XI_PointerKeyboardPairingChangedNotify;
-    ev.pointer = pPointer->id;
-    ev.keyboard = pKeyboard->id;
-    ev.length = 0;
-    ev.time = currentTime.milliseconds;
-    SendEventToAllWindows(inputInfo.pointer,
-            XI_PointerKeyboardPairingChangedMask,
-            (xEvent*)&ev, 1);
-    return Success;
-}
-
-/* Event swap proc */
-void
-SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from,
-                                                pairingChangedNotify *to)
-{
-    char n;
-
-    *to = *from;
-    swaps(&to->sequenceNumber, n);
-    swapl(&to->length, n);
-    swapl(&to->evtype, n);
-    swapl(&to->time, n);
-}
commit e4a214e40d35aa957c83b86b4e4abc86c22fbde0
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Jan 4 13:32:53 2008 +1030

    dix: don't free device's devPrivates manually, dixFreePrivates does it.
    
    Merge detritus from last pull.

diff --git a/dix/devices.c b/dix/devices.c
index 8d98f13..74212b2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -843,9 +843,6 @@ CloseDevice(DeviceIntPtr dev)
         }
     }
 
-    if (dev->devPrivates)
-	xfree(dev->devPrivates);
-
     xfree(dev->deviceGrab.sync.event);
     dixFreePrivates(dev->devPrivates);
     xfree(dev);
commit b2da44c76d68a76f20e90bccb268ebf65e132b49
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 3 18:51:44 2008 +1030

    dix: DoChangeKeyboardControl shouldn't be using inputInfo.keyboard.

diff --git a/dix/devices.c b/dix/devices.c
index f1a7595..8d98f13 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2016,8 +2016,8 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
 	case KBKey:
 	    key = (KeyCode)*vlist;
 	    vlist++;
-	    if ((KeyCode)key < inputInfo.keyboard->key->curKeySyms.minKeyCode ||
-		(KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode) {
+	    if ((KeyCode)key < keybd->key->curKeySyms.minKeyCode ||
+		(KeyCode)key > keybd->key->curKeySyms.maxKeyCode) {
 		client->errorValue = key;
 		return BadValue;
 	    }
commit 9cc41b88dfebb3f1e0a7cb5c224146e651a2cda4
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 3 18:47:28 2008 +1030

    Xi: ProcXSetClientPointer should directly check for the client from the id.
    
    The window ID includes the client ID anyway, so we might as well just look up
    the client directly instead of trying to get the window first and the client
    from the window.
    
    This also fixes a possible issue with XACE. If the client had permission to
    write on the client but not on the window, the previous approach would have
    failed.

diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 968e5cd..7313a9d 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -68,7 +68,6 @@ int
 ProcXSetClientPointer(ClientPtr client)
 {
     DeviceIntPtr pDev;
-    WindowPtr pWin;
     ClientPtr targetClient;
     int rc;
 
@@ -88,21 +87,12 @@ ProcXSetClientPointer(ClientPtr client)
 
     if (stuff->win != None)
     {
-        rc = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess);
+        rc = dixLookupClient(&targetClient, stuff->win, client,
+                DixWriteAccess);
+
         if (rc != Success)
-        {
-            /* window could not be found. maybe the window ID given was a pure
-               client id? */
-            /* XXX: Needs to be fixed for XACE */
-            rc = dixLookupClient(&targetClient, stuff->win,
-                                  client, DixWriteAccess);
-            if (rc != Success)
-            {
-                client->errorValue = stuff->win;
-                return rc;
-            }
-        } else
-            targetClient= wClient(pWin);
+            return rc;
+
     } else
         targetClient = client;
 
commit 521fdc28d86d091495da3558d26ab4a938250ffe
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 3 18:43:18 2008 +1030

    xfixes: switch a few inputInfo.pointer to PickPointer

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index a804a89..fd75df7 100755
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -355,7 +355,7 @@ ProcXFixesGetCursorImage (ClientPtr client)
 		  pCursor, RT_NONE, NULL, DixReadAccess);
     if (rc != Success)
 	return rc;
-    GetSpritePosition (inputInfo.pointer, &x, &y);
+    GetSpritePosition (PickPointer(client), &x, &y);
     width = pCursor->bits->width;
     height = pCursor->bits->height;
     npixels = width * height;
@@ -507,7 +507,7 @@ ProcXFixesGetCursorImageAndName (ClientPtr client)
 		  pCursor, RT_NONE, NULL, DixReadAccess|DixGetAttrAccess);
     if (rc != Success)
 	return rc;
-    GetSpritePosition (inputInfo.pointer, &x, &y);
+    GetSpritePosition (PickPointer(client), &x, &y);
     width = pCursor->bits->width;
     height = pCursor->bits->height;
     npixels = width * height;
@@ -879,7 +879,7 @@ ProcXFixesHideCursor (ClientPtr client)
     ret = createCursorHideCount(client, pWin->drawable.pScreen);
 
     if (ret == Success) {
-        (void) CursorDisplayCursor(inputInfo.pointer, pWin->drawable.pScreen, CursorCurrent);
+        (void) CursorDisplayCursor(PickPointer(client), pWin->drawable.pScreen, CursorCurrent);
     }
 
     return ret;
commit 37194b13554f0d36343cf73324b128b15bb6a338
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 3 18:36:33 2008 +1030

    Xi: switch to using "rc" (instead of "err") as returncode.
    
    All the rest of XI uses rc and returns rc in case of error, so make
    mpx-related stuff comply. This stops the rest of XI sending the error
    manually.
    This is just a cosmetic change to be in line with the rest.

diff --git a/Xi/chaccess.c b/Xi/chaccess.c
index 872612e..a58409b 100644
--- a/Xi/chaccess.c
+++ b/Xi/chaccess.c
@@ -63,7 +63,7 @@ SProcXChangeWindowAccess(ClientPtr client)
 int
 ProcXChangeWindowAccess(ClientPtr client)
 {
-    int padding, err, i;
+    int padding, rc, i;
     XID* deviceids = NULL;
     WindowPtr win;
     DeviceIntPtr* perm_devices = NULL;
@@ -77,27 +77,21 @@ ProcXChangeWindowAccess(ClientPtr client)
     if (stuff->length != ((sizeof(xChangeWindowAccessReq)  +
             (((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2))
     {
-        SendErrorToClient(client, IReqCode, X_ChangeWindowAccess,
-                0, BadLength);
-        return Success;
+        return BadLength;
     }
 
 
-    err = dixLookupWindow(&win, stuff->win, client, DixWriteAccess);
-    if (err != Success)
+    rc = dixLookupWindow(&win, stuff->win, client, DixWriteAccess);
+    if (rc != Success)
     {
-        SendErrorToClient(client, IReqCode, X_ChangeWindowAccess,
-                          stuff->win, err);
-        return Success;
+        return rc;
     }
 
     /* Are we clearing? if so, ignore the rest */
     if (stuff->clear)
     {
-        err = ACClearWindowAccess(client, win, stuff->clear);
-        if (err != Success)
-            SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, 0, err);
-        return Success;
+        rc = ACClearWindowAccess(client, win, stuff->clear);
+        return rc;
     }
 
     if (stuff->npermit || stuff->ndeny)
@@ -110,20 +104,18 @@ ProcXChangeWindowAccess(ClientPtr client)
         if (!perm_devices)
         {
             ErrorF("[Xi] ProcXChangeWindowAccess: alloc failure.\n");
-            SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, 0,
-                    BadImplementation);
-            return Success;
+            return BadImplementation;
         }
 
         /* if one of the devices cannot be accessed, we don't do anything.*/
         for (i = 0; i < stuff->npermit; i++)
         {
-            err = dixLookupDevice(&perm_devices[i], deviceids[i], client,
+            rc = dixLookupDevice(&perm_devices[i], deviceids[i], client,
                                   DixWriteAccess);
-            if (err != Success)
+            if (rc != Success)
             {
                 xfree(perm_devices);
-                return err;
+                return rc;
             }
         }
     }
@@ -135,36 +127,31 @@ ProcXChangeWindowAccess(ClientPtr client)
         if (!deny_devices)
         {
             ErrorF("[Xi] ProcXChangeWindowAccecss: alloc failure.\n");
-            SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, 0,
-                    BadImplementation);
-
             xfree(perm_devices);
-            return Success;
+            return BadImplementation;
         }
 
         for (i = 0; i < stuff->ndeny; i++)
         {
-            err = dixLookupDevice(&deny_devices[i],
+            rc = dixLookupDevice(&deny_devices[i],
                                   deviceids[i+stuff->npermit],
                                   client,
                                   DixWriteAccess);
-            if (err != Success)
+            if (rc != Success)
             {
                 xfree(perm_devices);
                 xfree(deny_devices);
-                return err;
+                return rc;
             }
         }
     }
 
-    err = ACChangeWindowAccess(client, win, stuff->defaultRule,
+    rc = ACChangeWindowAccess(client, win, stuff->defaultRule,
                                perm_devices, stuff->npermit,
                                deny_devices, stuff->ndeny);
-    if (err != Success)
+    if (rc != Success)
     {
-        SendErrorToClient(client, IReqCode, X_ChangeWindowAccess,
-                          stuff->win, err);
-        return Success;
+        return rc;
     }
 
     xfree(perm_devices);
diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c
index 0baee58..0a14900 100644
--- a/Xi/chdevcur.c
+++ b/Xi/chdevcur.c
@@ -71,7 +71,7 @@ SProcXChangeDeviceCursor(ClientPtr client)
 
 int ProcXChangeDeviceCursor(ClientPtr client)
 {
-    int err;
+    int rc;
     WindowPtr pWin    = NULL;
     DeviceIntPtr pDev = NULL;
     CursorPtr pCursor = NULL;
@@ -79,15 +79,15 @@ int ProcXChangeDeviceCursor(ClientPtr client)
     REQUEST(xChangeDeviceCursorReq);
     REQUEST_SIZE_MATCH(xChangeDeviceCursorReq);
 
-    err = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
-    if (err != Success)
-        return err;
+    rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
+    if (rc != Success)
+        return rc;
 
     if (stuff->win != None)
     {
-        err = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
-        if (err != Success)
-            return err;
+        rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
+        if (rc != Success)
+            return rc;
     }
 
     if (stuff->cursor == None)
@@ -103,9 +103,7 @@ int ProcXChangeDeviceCursor(ClientPtr client)
                                 RT_CURSOR, DixReadAccess);
         if (!pCursor)
         {
-            SendErrorToClient(client, IReqCode, X_ChangeDeviceCursor,
-                    stuff->cursor, BadCursor);
-            return Success;
+            return BadCursor;
         }
     }
 
diff --git a/Xi/extgrbdev.c b/Xi/extgrbdev.c
index 7738f15..72f8879 100644
--- a/Xi/extgrbdev.c
+++ b/Xi/extgrbdev.c
@@ -93,7 +93,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
 {
     xExtendedGrabDeviceReply rep;
     DeviceIntPtr             dev;
-    int                      err = Success,
+    int                      rc = Success,
                              errval = 0,
                              i;
     WindowPtr                grab_window,
@@ -122,12 +122,12 @@ ProcXExtendedGrabDevice(ClientPtr client)
             stuff->event_count + 2 * stuff->generic_event_count))
     {
         errval = 0;
-        err = BadLength;
+        rc = BadLength;
         goto cleanup;
     }
 
-    err = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
-    if (err != Success) {
+    rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
+    if (rc != Success) {
 	goto cleanup;
     }
 
@@ -138,11 +138,11 @@ ProcXExtendedGrabDevice(ClientPtr client)
         goto cleanup;
     }
 
-    err = dixLookupWindow(&grab_window,
+    rc = dixLookupWindow(&grab_window,
                           stuff->grab_window,
                           client,
                           DixReadAccess);
-    if (err != Success)
+    if (rc != Success)
     {
         errval = stuff->grab_window;
         goto cleanup;
@@ -150,11 +150,11 @@ ProcXExtendedGrabDevice(ClientPtr client)
 
     if (stuff->confine_to)
     {
-        err = dixLookupWindow(&confineTo,
+        rc = dixLookupWindow(&confineTo,
                               stuff->confine_to,
                               client,
                               DixReadAccess);
-        if (err != Success)
+        if (rc != Success)
         {
             errval = stuff->confine_to;
             goto cleanup;
@@ -170,7 +170,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
         if (!cursor)
         {
             errval = stuff->cursor;
-            err = BadCursor;
+            rc = BadCursor;
             goto cleanup;
         }
     }
@@ -205,7 +205,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
                   cursor, tmp[stuff->deviceid].mask,
                   gemasks);
 
-    if (err != Success) {
+    if (rc != Success) {
         errval = 0;
         goto cleanup;
     }
@@ -215,13 +215,13 @@ cleanup:
     if (gemasks)
         xfree(gemasks);
 
-    if (err == Success)
+    if (rc == Success)
     {
         WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
     }
     else
     {
-        return err;
+        return rc;
     }
     return Success;
 }
diff --git a/Xi/fakedevdata.c b/Xi/fakedevdata.c
index 7f2d3ec..92ee8ee 100644
--- a/Xi/fakedevdata.c
+++ b/Xi/fakedevdata.c
@@ -86,8 +86,7 @@ ProcXFakeDeviceData(ClientPtr client)
 
     if (stuff->length != (sizeof(xFakeDeviceDataReq) >> 2) + stuff->num_valuators)
     {
-        SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadLength);
-        return Success;
+        return BadLength;
     }
 
     rc = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
@@ -96,8 +95,7 @@ ProcXFakeDeviceData(ClientPtr client)
 
     if (!fake_events && !(fake_events = InitEventList(GetMaximumEventsNum())))
     {
-        SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadAlloc);
-        return Success;
+        return BadAlloc;
     }
     if (stuff->num_valuators)
     {
@@ -106,8 +104,7 @@ ProcXFakeDeviceData(ClientPtr client)
         valuators = xcalloc(stuff->num_valuators, sizeof(int));
         if (!valuators)
         {
-            SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadAlloc);
-            return Success;
+            return BadAlloc;
         }
         for (i = 0; i < stuff->num_valuators; i++, valptr++)
             valuators[i] = (int)(*valptr);
diff --git a/Xi/qryacces.c b/Xi/qryacces.c
index 673028c..ab627e2 100644
--- a/Xi/qryacces.c
+++ b/Xi/qryacces.c
@@ -64,7 +64,7 @@ SProcXQueryWindowAccess(ClientPtr client)
 int
 ProcXQueryWindowAccess(ClientPtr client)
 {
-    int err;
+    int rc;
     WindowPtr win;
     DeviceIntPtr *perm, *deny;
     int nperm, ndeny, i;
@@ -75,12 +75,10 @@ ProcXQueryWindowAccess(ClientPtr client)
     REQUEST(xQueryWindowAccessReq);
     REQUEST_SIZE_MATCH(xQueryWindowAccessReq);
 
-    err = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
-    if (err != Success)
+    rc = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
+    if (rc != Success)
     {
-        SendErrorToClient(client, IReqCode, X_QueryWindowAccess,
-                          stuff->win, err);
-        return Success;
+        return rc;
     }
 
     ACQueryWindowAccess(win, &defaultRule, &perm, &nperm, &deny, &ndeny);
@@ -100,9 +98,7 @@ ProcXQueryWindowAccess(ClientPtr client)
         if (!deviceids)
         {
             ErrorF("[Xi] ProcXQueryWindowAccess: xalloc failure.\n");
-            SendErrorToClient(client, IReqCode, X_QueryWindowAccess,
-                    0, BadImplementation);
-            return Success;
+            return BadImplementation;
         }
 
         for (i = 0; i < nperm; i++)
diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 8dd7181..968e5cd 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -70,15 +70,15 @@ ProcXSetClientPointer(ClientPtr client)
     DeviceIntPtr pDev;
     WindowPtr pWin;
     ClientPtr targetClient;
-    int err;
+    int rc;
 
     REQUEST(xSetClientPointerReq);
     REQUEST_SIZE_MATCH(xSetClientPointerReq);
 
 
-    err = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
-    if (err != Success)
-        return err;
+    rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
+    if (rc != Success)
+        return rc;
 
     if (!IsPointerDevice(pDev) || !pDev->isMaster)
     {
@@ -88,18 +88,18 @@ ProcXSetClientPointer(ClientPtr client)
 
     if (stuff->win != None)
     {
-        err = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess);
-        if (err != Success)
+        rc = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess);
+        if (rc != Success)
         {
             /* window could not be found. maybe the window ID given was a pure
                client id? */
             /* XXX: Needs to be fixed for XACE */
-            err = dixLookupClient(&targetClient, stuff->win,
+            rc = dixLookupClient(&targetClient, stuff->win,
                                   client, DixWriteAccess);
-            if (err != Success)
+            if (rc != Success)
             {
                 client->errorValue = stuff->win;
-                return err;
+                return rc;
             }
         } else
             targetClient= wClient(pWin);
diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c
index 24661d0..26081eb 100644
--- a/Xi/warpdevp.c
+++ b/Xi/warpdevp.c
@@ -70,7 +70,7 @@ SProcXWarpDevicePointer(ClientPtr client)
 int
 ProcXWarpDevicePointer(ClientPtr client)
 {
-    int err;
+    int rc;
     int x, y;
     WindowPtr dest = NULL;
     DeviceIntPtr pDev;
@@ -82,19 +82,17 @@ ProcXWarpDevicePointer(ClientPtr client)
 
     /* FIXME: panoramix stuff is missing, look at ProcWarpPointer */
 
-    err = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
+    rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
 
-    if (err != Success)
-        return err;
+    if (rc != Success)
+        return rc;
 
     if (stuff->dst_win != None)
     {
-        err = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
-        if (err != Success)
+        rc = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
+        if (rc != Success)
         {
-            SendErrorToClient(client, IReqCode, X_WarpDevicePointer,
-                    stuff->dst_win, err);
-            return Success;
+            return rc;
         }
     }
 
@@ -107,12 +105,10 @@ ProcXWarpDevicePointer(ClientPtr client)
         int winX, winY;
         WindowPtr src;
 
-        err = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
-        if (err != Success)
+        rc = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
+        if (rc != Success)
         {
-            SendErrorToClient(client, IReqCode, X_WarpDevicePointer,
-                    stuff->src_win, err);
-            return Success;
+            return rc;
         }
 
         winX = src->drawable.x;
diff --git a/Xi/xiselev.c b/Xi/xiselev.c
index 59f75b5..3c85032 100644
--- a/Xi/xiselev.c
+++ b/Xi/xiselev.c
@@ -59,16 +59,15 @@ SProcXiSelectEvent(ClientPtr client)
 int
 ProcXiSelectEvent(ClientPtr client)
 {
-    int ret;
+    int rc;
     WindowPtr pWin;
     REQUEST(xXiSelectEventReq);
     REQUEST_SIZE_MATCH(xXiSelectEventReq);
 
-    ret = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
-    if (ret != Success)
+    rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+    if (rc != Success)
     {
-        SendErrorToClient(client, IReqCode, X_XiSelectEvent, 0, ret);
-        return Success;
+        return rc;
     }
 
     GEWindowSetMask(client, pWin, IReqCode, stuff->mask);
commit c7e9b67c547c97b2c943eab555b4fe2844e8a91f
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 3 18:09:56 2008 +1030

    dix: free ClassesRec when a BadAlloc occurs during CoreKeyboardProc.

diff --git a/dix/devices.c b/dix/devices.c
index ed69cb8..f1a7595 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -415,12 +415,14 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
                                         keySyms.mapWidth);
         if (!keySyms.map) {
             ErrorF("[dix] Couldn't allocate core keymap\n");
+            xfree(classes);
             return BadAlloc;
         }
 
         modMap = (CARD8 *)xalloc(MAP_LENGTH);
         if (!modMap) {
             ErrorF("[dix] Couldn't allocate core modifier map\n");
+            xfree(classes);
             return BadAlloc;
         }
         bzero((char *)modMap, MAP_LENGTH);


More information about the xorg-commit mailing list