diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-12-11 00:46:22 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-12-18 16:51:45 -0800 |
commit | eb750f8b5e14751d4c40b50499baec5d2ba79db9 (patch) | |
tree | 48791902f8ebe6f6422787285accb13d44e25b8a /Xext | |
parent | 1df4bd6011e110dcf0649b15bfffd4ab9e6961d6 (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 'Xext')
-rw-r--r-- | Xext/mbuf.c | 4 | ||||
-rw-r--r-- | Xext/panoramiX.c | 16 | ||||
-rw-r--r-- | Xext/sync.c | 8 | ||||
-rw-r--r-- | Xext/xvdisp.c | 4 |
4 files changed, 21 insertions, 11 deletions
diff --git a/Xext/mbuf.c b/Xext/mbuf.c index 1f2497463..af312212f 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -467,7 +467,9 @@ MultibufferExtensionInit() * create the resource types */ MultibufferDrawableResType = - CreateNewResourceType(MultibufferDrawableDelete)|RC_DRAWABLE; + CreateNewResourceType(MultibufferDrawableDelete); + if (MultiBufferDrawableResType) + MultibufferDrawableResType |= RC_DRAWABLE; MultibufferResType = CreateNewResourceType(MultibufferDelete); MultibuffersResType = CreateNewResourceType(MultibuffersDelete); OtherClientResType = CreateNewResourceType(OtherClientDelete); diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 4b7b07e1d..f48bd36a6 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -503,15 +503,19 @@ void PanoramiXExtensionInit(int argc, char *argv[]) } XRC_DRAWABLE = CreateNewResourceClass(); - XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) | - XRC_DRAWABLE; - XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) | - XRC_DRAWABLE; + XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource); + if (XRT_WINDOW) + XRT_WINDOW |= XRC_DRAWABLE; + XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource); + if (XRT_PIXMAP) + XRT_PIXMAP |= XRC_DRAWABLE; XRT_GC = CreateNewResourceType(XineramaDeleteResource); XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource); - panoramiXGeneration = serverGeneration; - success = TRUE; + if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) { + panoramiXGeneration = serverGeneration; + success = TRUE; + } } if (!success) { diff --git a/Xext/sync.c b/Xext/sync.c index 667f8ab78..d8a2b1535 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -2113,8 +2113,12 @@ SyncExtensionInit(void) RTCounter = CreateNewResourceType(FreeCounter); } RTAlarm = CreateNewResourceType(FreeAlarm); - RTAwait = CreateNewResourceType(FreeAwait)|RC_NEVERRETAIN; - RTAlarmClient = CreateNewResourceType(FreeAlarmClient)|RC_NEVERRETAIN; + RTAwait = CreateNewResourceType(FreeAwait); + if (RTAwait) + RTAwait |= RC_NEVERRETAIN; + RTAlarmClient = CreateNewResourceType(FreeAlarmClient); + if (RTAlarmClient) + RTAlarmClient |= RC_NEVERRETAIN; if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 || RTAlarmClient == 0 || diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 5229916a9..1f3fc0f3d 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1865,8 +1865,8 @@ void XineramifyXv(void) XvXRTPort = CreateNewResourceType(XineramaDeleteResource); - if(!xvsp0) return; - + if (!xvsp0 || !XvXRTPort) return; + for(i = 0; i < xvsp0->nAdaptors; i++) { refAdapt = xvsp0->pAdaptors + i; |