aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/devices.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-06 09:12:35 +0200
committermarha <marha@users.sourceforge.net>2012-07-06 09:13:41 +0200
commit336bad93d146931c160d8517edfdf0bee49ad9f7 (patch)
treed0fbdb5a716e78aa6318c7ddd49bd3e09e13379f /xorg-server/dix/devices.c
parentfc8f37239f3af088819c18f5632b2608954af73a (diff)
downloadvcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.tar.gz
vcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.tar.bz2
vcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.zip
randrproto fontconfig mesa xserver git update 6 Jul 2012
Diffstat (limited to 'xorg-server/dix/devices.c')
-rw-r--r--xorg-server/dix/devices.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 08875bc3a..70fb273c9 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -246,13 +246,17 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
if (devid >= MAXDEVICES)
return (DeviceIntPtr) NULL;
- dev =
- _dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) +
- sizeof(SpriteInfoRec),
- sizeof(DeviceIntRec) +
- sizeof(SpriteInfoRec),
- offsetof(DeviceIntRec, devPrivates),
- PRIVATE_DEVICE);
+ dev = calloc(1,
+ sizeof(DeviceIntRec) +
+ sizeof(SpriteInfoRec));
+ if (!dev)
+ return (DeviceIntPtr) NULL;
+
+ if (!dixAllocatePrivates(&dev->devPrivates, PRIVATE_DEVICE)) {
+ free(dev);
+ return NULL;
+ }
+
if (!dev)
return (DeviceIntPtr) NULL;
@@ -282,6 +286,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
/* security creation/labeling check
*/
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) {
+ dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE);
free(dev);
return NULL;
}
@@ -961,7 +966,8 @@ CloseDevice(DeviceIntPtr dev)
free(dev->last.touches[j].valuators);
free(dev->last.touches);
dev->config_info = NULL;
- dixFreeObjectWithPrivates(dev, PRIVATE_DEVICE);
+ dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE);
+ free(dev);
}
/**