summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-03-26 02:02:48 +0000
committerIan Romanick <[email protected]>2004-03-26 02:02:48 +0000
commit3623579e43b4c3a8d2eb7edb6efaa6f178279ec9 (patch)
tree805742389c1e00372ff151805bbd8a6d87045893 /src/mesa
parent301e55c6cd27e50a9186f096a974321b6df2c511 (diff)
Make sure drivers don't dereference a NULL pointer if
__driUtilCreateNewScreen returns NULL.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c16
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c20
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c20
-rw-r--r--src/mesa/drivers/dri/r200/r200_screen.c20
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c20
5 files changed, 48 insertions, 48 deletions
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 232f62d41d8..a095b28add1 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -439,14 +439,14 @@ void * __driCreateNewScreen( Display *dpy, int scrn, __DRIscreen *psc,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &i810API);
-
-
- create_context_modes =
- (PFNGLXCREATECONTEXTMODES) glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
- if ( create_context_modes != NULL ) {
- *driver_modes = i810FillInModes( 16,
- 16, 0,
- 1);
+ if ( psp != NULL ) {
+ create_context_modes = (PFNGLXCREATECONTEXTMODES)
+ glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
+ if ( create_context_modes != NULL ) {
+ *driver_modes = i810FillInModes( 16,
+ 16, 0,
+ 1);
+ }
}
return (void *) psp;
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index fa1c1515433..6ef16c11b27 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -538,16 +538,16 @@ void * __driCreateNewScreen( Display *dpy, int scrn, __DRIscreen *psc,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &mach64API);
-
-
- create_context_modes =
- (PFNGLXCREATECONTEXTMODES) glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
- if ( create_context_modes != NULL ) {
- ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
- *driver_modes = mach64FillInModes( dri_priv->cpp * 8,
- 16,
- 0,
- 1);
+ if ( psp != NULL ) {
+ create_context_modes = (PFNGLXCREATECONTEXTMODES)
+ glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
+ if ( create_context_modes != NULL ) {
+ ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
+ *driver_modes = mach64FillInModes( dri_priv->cpp * 8,
+ 16,
+ 0,
+ 1);
+ }
}
return (void *) psp;
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 3b65e7a40c3..f0fe8d2c049 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -967,16 +967,16 @@ void * __driCreateNewScreen( Display *dpy, int scrn, __DRIscreen *psc,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &mgaAPI);
-
-
- create_context_modes =
- (PFNGLXCREATECONTEXTMODES) glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
- if ( create_context_modes != NULL ) {
- MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
- *driver_modes = mgaFillInModes( dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
+ if ( psp != NULL ) {
+ create_context_modes = (PFNGLXCREATECONTEXTMODES)
+ glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
+ if ( create_context_modes != NULL ) {
+ MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
+ *driver_modes = mgaFillInModes( dri_priv->cpp * 8,
+ (dri_priv->cpp == 2) ? 16 : 24,
+ (dri_priv->cpp == 2) ? 0 : 8,
+ (dri_priv->backOffset != dri_priv->depthOffset) );
+ }
}
return (void *) psp;
diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c
index 45683d8143b..e356309ae10 100644
--- a/src/mesa/drivers/dri/r200/r200_screen.c
+++ b/src/mesa/drivers/dri/r200/r200_screen.c
@@ -640,16 +640,16 @@ void * __driCreateNewScreen( Display *dpy, int scrn, __DRIscreen *psc,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &r200API);
-
-
- create_context_modes =
- (PFNGLXCREATECONTEXTMODES) glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
- if ( create_context_modes != NULL ) {
- RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
- *driver_modes = r200FillInModes( dri_priv->bpp,
- (dri_priv->bpp == 16) ? 16 : 24,
- (dri_priv->bpp == 16) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
+ if ( psp != NULL ) {
+ create_context_modes = (PFNGLXCREATECONTEXTMODES)
+ glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
+ if ( create_context_modes != NULL ) {
+ RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
+ *driver_modes = r200FillInModes( dri_priv->bpp,
+ (dri_priv->bpp == 16) ? 16 : 24,
+ (dri_priv->bpp == 16) ? 0 : 8,
+ (dri_priv->backOffset != dri_priv->depthOffset) );
+ }
}
return (void *) psp;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index c3ddb994864..8d26935e6be 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -602,16 +602,16 @@ void * __driCreateNewScreen( Display *dpy, int scrn, __DRIscreen *psc,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &radeonAPI);
-
-
- create_context_modes =
- (PFNGLXCREATECONTEXTMODES) glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
- if ( create_context_modes != NULL ) {
- RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
- *driver_modes = radeonFillInModes( dri_priv->bpp,
- (dri_priv->bpp == 16) ? 16 : 24,
- (dri_priv->bpp == 16) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
+ if ( psp != NULL ) {
+ create_context_modes = (PFNGLXCREATECONTEXTMODES)
+ glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
+ if ( create_context_modes != NULL ) {
+ RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
+ *driver_modes = radeonFillInModes( dri_priv->bpp,
+ (dri_priv->bpp == 16) ? 16 : 24,
+ (dri_priv->bpp == 16) ? 0 : 8,
+ (dri_priv->backOffset != dri_priv->depthOffset) );
+ }
}
return (void *) psp;