diff options
author | José Fonseca <[email protected]> | 2011-11-09 19:29:37 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2012-02-03 18:51:14 +0000 |
commit | 8184228e8b894b434a87387c79d9a11a50684272 (patch) | |
tree | 92988e9d4d7c95f5826ac745fa599c0bb2538fc4 | |
parent | 9a1fd9a37ce3ee2ede5bef5cf508a02f3bdb6098 (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]>
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_texture.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 8fac77b0c57..e895485e947 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -978,7 +978,9 @@ alloc_image_data(struct llvmpipe_resource *lpr, unsigned level, /* tiled data is stored in regular memory */ uint buffer_size = tex_image_size(lpr, level, layout); lpr->tiled[level].data = align_malloc(buffer_size, alignment); - memset(lpr->tiled[level].data, 0, buffer_size); + if (lpr->tiled[level].data) { + memset(lpr->tiled[level].data, 0, buffer_size); + } } else { assert(layout == LP_TEX_LAYOUT_LINEAR); @@ -997,7 +999,9 @@ alloc_image_data(struct llvmpipe_resource *lpr, unsigned level, /* not a display target - allocate regular memory */ uint buffer_size = tex_image_size(lpr, level, LP_TEX_LAYOUT_LINEAR); lpr->linear[level].data = align_malloc(buffer_size, alignment); - memset(lpr->linear[level].data, 0, buffer_size); + if (lpr->linear[level].data) { + memset(lpr->linear[level].data, 0, buffer_size); + } } } } |