fix potential NULL dereference (bug 11879)
authorBrian <brian.paul@tungstengraphics.com>
Tue, 7 Aug 2007 20:57:29 +0000 (21:57 +0100)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 7 Aug 2007 20:57:29 +0000 (21:57 +0100)
src/mesa/drivers/dri/unichrome/via_context.c

index 4d25d328e333d96d68ed80ae735db4c4f9f8d261..7c73877720958c25ddf282dc1e57afe82a1f0d38 100644 (file)
@@ -733,14 +733,15 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
 {
    __DRIdrawablePrivate *const drawable = vmesa->driDrawable;
    __DRIdrawablePrivate *const readable = vmesa->driReadable;
-   struct via_renderbuffer *const draw_buffer = 
-     (struct via_renderbuffer *) drawable->driverPrivate;
-   struct via_renderbuffer *const read_buffer =
-     (struct via_renderbuffer *) readable->driverPrivate;
+   struct via_renderbuffer * draw_buffer;
+   struct via_renderbuffer * read_buffer;
    GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
 
    if (!drawable)
       return;
+
+   draw_buffer =  (struct via_renderbuffer *) drawable->driverPrivate;
+   read_buffer =  (struct via_renderbuffer *) readable->driverPrivate;
    
    switch (vmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
    case BUFFER_BIT_BACK_LEFT: