aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/devices.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-06 09:31:01 +0200
committermarha <marha@users.sourceforge.net>2012-07-06 09:31:01 +0200
commit405ae9defaaa03d4d305b6264a744107c3dd460d (patch)
treee119a54d876fa737d859718afbde7ef507702631 /xorg-server/dix/devices.c
parent3a5976985ab1ca641b095a72730f1f3d3bd5f9bc (diff)
parent336bad93d146931c160d8517edfdf0bee49ad9f7 (diff)
downloadvcxsrv-405ae9defaaa03d4d305b6264a744107c3dd460d.tar.gz
vcxsrv-405ae9defaaa03d4d305b6264a744107c3dd460d.tar.bz2
vcxsrv-405ae9defaaa03d4d305b6264a744107c3dd460d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/dix/dispatch.c xorg-server/dix/privates.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/src/kinput.c
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 02c560216..49b33041b 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -250,13 +250,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;
@@ -286,6 +290,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;
}
@@ -965,7 +970,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);
}
/**