Module: Mesa
Branch: mesa_7_6_branch
Commit: b3e41e0d5e03b040768547293e05e6540d3c8e4d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3e41e0d5e03b040768547293e05e6540d3c8e4d

Author: Brian Paul <[email protected]>
Date:   Thu Oct  1 14:49:34 2009 -0600

st/mesa: check for null before asserts, fix possible mem leak

---

 src/mesa/state_tracker/st_cb_fbo.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index fe0a121..e8399de 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -165,12 +165,12 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct 
gl_renderbuffer *rb,
                                                      strb->texture,
                                                      0, 0, 0,
                                                      surface_usage );
-
-      assert(strb->surface->texture);
-      assert(strb->surface->format);
-      assert(strb->surface->width == width);
-      assert(strb->surface->height == height);
-
+      if (strb->surface) {
+         assert(strb->surface->texture);
+         assert(strb->surface->format);
+         assert(strb->surface->width == width);
+         assert(strb->surface->height == height);
+      }
 
       return strb->surface != NULL;
    }
@@ -298,6 +298,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int 
samples, boolean sw)
    default:
       _mesa_problem(NULL,
                    "Unexpected format in st_new_renderbuffer_fb");
+      _mesa_free(strb);
       return NULL;
    }
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to