[Mesa-dev] [PATCH] vbo: add a null pointer check to handle OOM instead of crashing

Brian Paul brianp at vmware.com
Thu Jan 24 15:35:32 PST 2013


Note: This is a candidate for the 9.0 branch.
---
 src/mesa/vbo/vbo_exec_api.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 985f220..353f8cf 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -124,6 +124,11 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec )
     */
    vbo_exec_wrap_buffers( exec );
    
+   if (!exec->vtx.buffer_ptr) {
+      /* probably ran out of memory earlier when allocating the VBO */
+      return;
+   }
+
    /* Copy stored stored vertices to start of new list. 
     */
    assert(exec->vtx.max_vert - exec->vtx.vert_count > exec->vtx.copied.nr);
-- 
1.7.3.4



More information about the mesa-dev mailing list