From: Brian Paul Date: Mon, 3 Dec 2012 15:30:04 +0000 (-0700) Subject: st/mesa: add null pointer check in st_renderbuffer_delete() X-Git-Tag: accepted/2.0alpha-wayland/20130301.050525~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d32aff91c1c42b3f8bfb6c4109a8ea79c1f46d8d;p=profile%2Fivi%2Fmesa.git st/mesa: add null pointer check in st_renderbuffer_delete() In my testing I haven't found any cases where we get a null context pointer, but it might still be possible. Check for null just to be safe. Note: This is a candidate for the stable branches. (cherry picked from commit a4311054c78536acba0c3006c5d2805e182fa483) --- diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 755697c..2b2c1fb 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -228,10 +228,10 @@ static void st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); - struct st_context *st = st_context(ctx); - struct pipe_context *pipe = st->pipe; - - pipe_surface_release(pipe, &strb->surface); + if (ctx) { + struct st_context *st = st_context(ctx); + pipe_surface_release(st->pipe, &strb->surface); + } pipe_resource_reference(&strb->texture, NULL); free(strb->data); _mesa_delete_renderbuffer(ctx, rb);