summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pipe_offset.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@vmware.com>2010-06-16 12:27:20 +0100
committerAlan Hourihane <alanh@vmware.com>2010-06-16 12:27:53 +0100
commit1c377cea1094c0b5414c663adf2fd393bf41ddfb (patch)
tree29b43d404690b3cac848994848314770480e26f6 /src/gallium/auxiliary/draw/draw_pipe_offset.c
parent9829ec2ad8cf74c6dbc7d8afbf36ddd5c5210d74 (diff)
draw: handle some out of memory conditions
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_offset.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index 8e321946ce..8afbbfa156 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -161,9 +161,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
{
struct offset_stage *offset = CALLOC_STRUCT(offset_stage);
if (offset == NULL)
- return NULL;
-
- draw_alloc_temp_verts( &offset->stage, 3 );
+ goto fail;
offset->stage.draw = draw;
offset->stage.name = "offset";
@@ -175,5 +173,14 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
offset->stage.reset_stipple_counter = offset_reset_stipple_counter;
offset->stage.destroy = offset_destroy;
+ if (!draw_alloc_temp_verts( &offset->stage, 3 ))
+ goto fail;
+
return &offset->stage;
+
+fail:
+ if (offset)
+ offset->stage.destroy( &offset->stage );
+
+ return NULL;
}