From 649269d40667cfb387cb5286dd3519dd68f7dd80 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Wed, 16 Feb 2011 16:55:57 -0800 Subject: 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 Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/xichangehierarchy.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Xi') 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; -- cgit v1.2.3