mesa: Add assert to check for null pointer dereference.
authorVinson Lee <vlee@vmware.com>
Sun, 21 Feb 2010 10:13:15 +0000 (02:13 -0800)
committerVinson Lee <vlee@vmware.com>
Sun, 21 Feb 2010 10:13:15 +0000 (02:13 -0800)
src/mesa/main/framebuffer.c

index 065e25f..269bc9a 100644 (file)
@@ -829,8 +829,12 @@ update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
 void
 _mesa_update_framebuffer(GLcontext *ctx)
 {
-   struct gl_framebuffer *drawFb = ctx->DrawBuffer;
-   struct gl_framebuffer *readFb = ctx->ReadBuffer;
+   struct gl_framebuffer *drawFb;
+   struct gl_framebuffer *readFb;
+
+   assert(ctx);
+   drawFb = ctx->DrawBuffer;
+   readFb = ctx->ReadBuffer;
 
    update_framebuffer(ctx, drawFb);
    if (readFb != drawFb)