dix: protect from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
ba4fb2588e
commit
e025b8c805
|
@ -284,7 +284,10 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
|||
dev->deviceGrab.grabTime = currentTime;
|
||||
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
|
||||
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
|
||||
dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent));
|
||||
if (!(dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent)))) {
|
||||
free(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dev->sendEventsProc = XTestDeviceSendEvents;
|
||||
|
||||
|
@ -1692,7 +1695,8 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
|
|||
touch->sourceid = device->id;
|
||||
|
||||
device->touch = touch;
|
||||
device->last.touches = calloc(max_touches, sizeof(*device->last.touches));
|
||||
if (!(device->last.touches = calloc(max_touches, sizeof(*device->last.touches))))
|
||||
goto err;
|
||||
device->last.num_touches = touch->num_touches;
|
||||
for (i = 0; i < touch->num_touches; i++)
|
||||
TouchInitDDXTouchPoint(device, &device->last.touches[i]);
|
||||
|
@ -2907,6 +2911,11 @@ AllocDevicePair(ClientPtr client, const char *name,
|
|||
if (InputDevIsMaster(pointer)) {
|
||||
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||
if (!pointer->unused_classes || !keyboard->unused_classes) {
|
||||
free(keyboard->unused_classes);
|
||||
free(pointer->unused_classes);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr = pointer;
|
||||
|
|
Loading…
Reference in New Issue