summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pipe_pstipple.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_pstipple.c
parent9829ec2ad8cf74c6dbc7d8afbf36ddd5c5210d74 (diff)
draw: handle some out of memory conditions
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_pstipple.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index ef30db094f..fff960c7eb 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -607,8 +607,8 @@ static struct pstip_stage *
draw_pstip_stage(struct draw_context *draw)
{
struct pstip_stage *pstip = CALLOC_STRUCT(pstip_stage);
-
- draw_alloc_temp_verts( &pstip->stage, 8 );
+ if (pstip == NULL)
+ goto fail;
pstip->stage.draw = draw;
pstip->stage.name = "pstip";
@@ -620,7 +620,16 @@ draw_pstip_stage(struct draw_context *draw)
pstip->stage.reset_stipple_counter = pstip_reset_stipple_counter;
pstip->stage.destroy = pstip_destroy;
+ if (!draw_alloc_temp_verts( &pstip->stage, 8 ))
+ goto fail;
+
return pstip;
+
+fail:
+ if (pstip)
+ pstip->stage.destroy( &pstip->stage );
+
+ return NULL;
}