Mesa (master): llvmpipe: fail cleanly on malloc failure in lp_setup_alloc_triangle

Keith Whitwell keithw at kemper.freedesktop.org
Mon Oct 18 01:49:48 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sun Oct 17 18:48:11 2010 -0700

llvmpipe: fail cleanly on malloc failure in lp_setup_alloc_triangle

---

 src/gallium/drivers/llvmpipe/lp_setup_tri.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index c6cb9af..15c414d 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -86,9 +86,10 @@ lp_setup_alloc_triangle(struct lp_scene *scene,
                 plane_sz);
 
    tri = lp_scene_alloc_aligned( scene, *tri_size, 16 );
-   if (tri) {
-      tri->inputs.stride = input_array_sz;
-   }
+   if (tri == NULL)
+      return NULL;
+
+   tri->inputs.stride = input_array_sz;
 
    {
       char *a = (char *)tri;
@@ -96,7 +97,6 @@ lp_setup_alloc_triangle(struct lp_scene *scene,
       assert(b - a == *tri_size);
    }
 
-
    return tri;
 }
 




More information about the mesa-commit mailing list