diff options
author | Brian Paul <[email protected]> | 2010-05-28 12:49:49 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-05-28 12:52:41 -0600 |
commit | 151b3bb3af722f0e14e209171acc2239d3cf2817 (patch) | |
tree | a9179a9f201d5656006923def5ddfbf2f9dfc53f /src/gallium | |
parent | 5d0e136eff54a34258b5adaeda4cb267831e8234 (diff) |
llvmpipe: add out of memory checking to triangle setup path
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 306cb6e27d2..34d71254b23 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -272,12 +272,14 @@ alloc_triangle(struct lp_scene *scene, unsigned nr_inputs, unsigned *tri_size) tri = lp_scene_alloc_aligned( scene, bytes, 16 ); - inputs = (char *) (tri + 1); - tri->inputs.a0 = (float (*)[4]) inputs; - tri->inputs.dadx = (float (*)[4]) (inputs + input_array_sz); - tri->inputs.dady = (float (*)[4]) (inputs + 2 * input_array_sz); + if (tri) { + inputs = (char *) (tri + 1); + tri->inputs.a0 = (float (*)[4]) inputs; + tri->inputs.dadx = (float (*)[4]) (inputs + input_array_sz); + tri->inputs.dady = (float (*)[4]) (inputs + 2 * input_array_sz); - *tri_size = bytes; + *tri_size = bytes; + } return tri; } @@ -341,6 +343,8 @@ do_triangle_ccw(struct lp_setup_context *setup, print_triangle(setup, v1, v2, v3); tri = alloc_triangle(scene, setup->fs.nr_inputs, &tri_bytes); + if (!tri) + return; #ifdef DEBUG tri->v[0][0] = v1[0][0]; |