summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorBryce Harrington <bryce@canonical.com>2011-02-16 16:55:57 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-17 15:38:27 +1000
commit649269d40667cfb387cb5286dd3519dd68f7dd80 (patch)
tree99318684c2484ed0f2b2d2c97b37e133e9eb55d3 /Xi
parent31ddb7ef4f5bac2c13c199e74a0716e43b8dc38e (diff)
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>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/xichangehierarchy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index b9cdedf77..21c74ed7a 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -70,6 +70,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev = calloc(1, sizeof(xXIHierarchyEvent) +
MAXDEVICES * sizeof(xXIHierarchyInfo));
+ if (!ev)
+ return;
ev->type = GenericEvent;
ev->extension = IReqCode;
ev->evtype = XI_HierarchyChanged;