summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-11-28 16:54:09 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-12-08 17:59:33 +0000
commitf32c7232a8a16887af710a11f025381bc73640f0 (patch)
treebf9a3911c3b0cdd87e6310bd744a195c6d8502dc /src/gallium/auxiliary/draw
parent24e648490921a386fc3f65d1b1ed330067a4bb25 (diff)
llvmpipe,draw,gallivm: Ensure we don't walk beyond the end of the shader variant list.
u_simple_list.h uses a sentinel element, and not a NULL element. So ensure list is not empty when reducing the list of shader variants. Something I noticed while trying to free variants more aggressively. Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index 7698f5ff2af..de6ce7fad40 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -160,8 +160,13 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
* XXX: should we flush here ?
*/
for (i = 0; i < DRAW_MAX_SHADER_VARIANTS / 4; i++) {
- struct draw_llvm_variant_list_item *item =
- last_elem(&fpme->llvm->vs_variants_list);
+ struct draw_llvm_variant_list_item *item;
+ if (is_empty_list(&fpme->llvm->vs_variants_list)) {
+ break;
+ }
+ item = last_elem(&fpme->llvm->vs_variants_list);
+ assert(item);
+ assert(item->base);
draw_llvm_destroy_variant(item->base);
}
}