[PATCH] Check for OOM condition in XISendDeviceHierarchyEvent
Bryce Harrington
bryce at canonical.com
Wed Feb 16 16:55:57 PST 2011
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 at canonical.com>
---
Xi/xichangehierarchy.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index b9cdedf..21c74ed 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;
--
1.7.2.3
More information about the xorg-devel
mailing list