summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-12-11 00:46:22 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-12-18 16:51:45 -0800
commiteb750f8b5e14751d4c40b50499baec5d2ba79db9 (patch)
tree48791902f8ebe6f6422787285accb13d44e25b8a /hw
parent1df4bd6011e110dcf0649b15bfffd4ab9e6961d6 (diff)
Check for failures from CreateNewResourceType
Make sure to check return value before setting bitmask flags. For most calls, just fails to init the extension. Since Xinput already calls FatalError() on initialization failure, so does failure to allocate Xinput's resource type. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/dmx/glxProxy/glxext.c4
-rw-r--r--hw/kdrive/ephyr/ephyrdriext.c4
-rw-r--r--hw/xfree86/dri/dri.c3
-rw-r--r--hw/xfree86/dri2/dri2ext.c6
-rw-r--r--hw/xquartz/xpr/dri.c2
5 files changed, 17 insertions, 2 deletions
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index b30d144ee..0c3906897 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -299,6 +299,10 @@ void GlxExtensionInit(void)
__glXWindowRes = CreateNewResourceType((DeleteType)WindowGone);
__glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone);
+ if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes ||
+ !__glXWindowRes || !__glXPbufferRes)
+ return;
+
/*
** Add extension to server extensions.
*/
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 231b0985c..ba1733bdf 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -141,6 +141,10 @@ ephyrDRIExtensionInit (ScreenPtr a_screen)
#ifdef XF86DRI_EVENTS
EventType = CreateNewResourceType (XF86DRIFreeEvents);
+ if (!EventType) {
+ EPHYR_LOG_ERROR ("failed to register DRI event resource type\n") ;
+ goto out ;
+ }
#endif
if ((extEntry = AddExtension(XF86DRINAME,
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 0de9be621..1a6cb4d83 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -792,6 +792,9 @@ DRIExtensionInit(void)
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
+ if (!DRIDrawablePrivResType || !DRIContextPrivResType)
+ return FALSE;
+
RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
return TRUE;
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index dc07b47af..8acf26709 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -416,6 +416,11 @@ static int DRI2DrawableGone(pointer p, XID id)
static void
DRI2ExtensionInit(void)
{
+ dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
+
+ if (!dri2DrawableRes)
+ return;
+
dri2Extension = AddExtension(DRI2_NAME,
DRI2NumberEvents,
DRI2NumberErrors,
@@ -424,7 +429,6 @@ DRI2ExtensionInit(void)
NULL,
StandardMinorOpcode);
- dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
}
extern Bool noDRI2Extension;
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index f570bee5d..a9c0f2234 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -279,7 +279,7 @@ DRIExtensionInit(void)
{
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
- return TRUE;
+ return (DRIDrawablePrivResType != 0);
}
void