summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_scene.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-05-04 13:19:19 -0600
committerBrian Paul <[email protected]>2010-05-04 17:17:04 -0600
commit0671c6b5891f38347a3186f367913d674d3196c4 (patch)
tree96ffe5c54a9b2ba0f8f2704b591928f1e8c5379f /src/gallium/drivers/llvmpipe/lp_scene.c
parent2649d64fee6f67f0bdb1630869d82baa1636fca2 (diff)
llvmpipe: add some tests for malloc() returning NULL.
Start propogating NULL pointers from allocation functions and checks for NULL in the callers...
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_scene.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 887f2dbad91..ff4d6340eb1 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -210,25 +210,31 @@ lp_scene_reset(struct lp_scene *scene )
-void
+struct cmd_block *
lp_bin_new_cmd_block( struct cmd_block_list *list )
{
struct cmd_block *block = MALLOC_STRUCT(cmd_block);
- list->tail->next = block;
- list->tail = block;
- block->next = NULL;
- block->count = 0;
+ if (block) {
+ list->tail->next = block;
+ list->tail = block;
+ block->next = NULL;
+ block->count = 0;
+ }
+ return block;
}
-void
+struct data_block *
lp_bin_new_data_block( struct data_block_list *list )
{
struct data_block *block = MALLOC_STRUCT(data_block);
- list->tail->next = block;
- list->tail = block;
- block->next = NULL;
- block->used = 0;
+ if (block) {
+ list->tail->next = block;
+ list->tail = block;
+ block->next = NULL;
+ block->used = 0;
+ }
+ return block;
}