summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_rast.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-11-09 19:29:37 +0000
committerJosé Fonseca <[email protected]>2011-11-14 10:06:01 +0000
commitc88f3e0374620f18cf38d9fc3c45d14bc53f62b2 (patch)
tree05de7d375c47328da0097a62cbf239b442de85c4 /src/gallium/drivers/llvmpipe/lp_rast.c
parent9e29cdbe95810de8658dfd1cabf1a7d87264c2f7 (diff)
llvmpipe: Make more resilient to out-of-memory situations.
Most of the code was alright, but we were missing a few paths. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index c4560bfe6c0..873c2612e89 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -879,10 +879,14 @@ lp_rast_create( unsigned num_threads )
unsigned i;
rast = CALLOC_STRUCT(lp_rasterizer);
- if(!rast)
- return NULL;
+ if (!rast) {
+ goto no_rast;
+ }
rast->full_scenes = lp_scene_queue_create();
+ if (!rast->full_scenes) {
+ goto no_full_scenes;
+ }
for (i = 0; i < Elements(rast->tasks); i++) {
struct lp_rasterizer_task *task = &rast->tasks[i];
@@ -902,6 +906,11 @@ lp_rast_create( unsigned num_threads )
memset(lp_dummy_tile, 0, sizeof lp_dummy_tile);
return rast;
+
+no_full_scenes:
+ FREE(rast);
+no_rast:
+ return NULL;
}