Check for OOM condition in XISendDeviceHierarchyEvent
When system is out of memory, calloc can fail returning a NULL pointer. Check for this before dereferencing it, and bail out if it fails. Ref.: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/720445 Signed-off-by: Bryce Harrington <bryce@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
31ddb7ef4f
commit
649269d406
|
@ -70,6 +70,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
|
|
||||||
ev = calloc(1, sizeof(xXIHierarchyEvent) +
|
ev = calloc(1, sizeof(xXIHierarchyEvent) +
|
||||||
MAXDEVICES * sizeof(xXIHierarchyInfo));
|
MAXDEVICES * sizeof(xXIHierarchyInfo));
|
||||||
|
if (!ev)
|
||||||
|
return;
|
||||||
ev->type = GenericEvent;
|
ev->type = GenericEvent;
|
||||||
ev->extension = IReqCode;
|
ev->extension = IReqCode;
|
||||||
ev->evtype = XI_HierarchyChanged;
|
ev->evtype = XI_HierarchyChanged;
|
||||||
|
|
Loading…
Reference in New Issue