diff options
author | Bruno Jiménez <[email protected]> | 2014-05-19 18:14:52 +0200 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2014-06-10 15:29:57 -0400 |
commit | 833b55077378c7c0e612edcb0fb5b3f5d0e07f48 (patch) | |
tree | a6cf8bdf5aa1a4fa6b00b020d14bbdc4e676c36b /src/gallium/drivers/r600/compute_memory_pool.c | |
parent | fd943fa6c219fbddaeb95e6518eebb2522687561 (diff) |
r600g/compute: Adding checks for NULL after CALLOC
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/compute_memory_pool.c')
-rw-r--r-- | src/gallium/drivers/r600/compute_memory_pool.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c index ccbb21197e2..7143545ad6d 100644 --- a/src/gallium/drivers/r600/compute_memory_pool.c +++ b/src/gallium/drivers/r600/compute_memory_pool.c @@ -49,6 +49,8 @@ struct compute_memory_pool* compute_memory_pool_new( { struct compute_memory_pool* pool = (struct compute_memory_pool*) CALLOC(sizeof(struct compute_memory_pool), 1); + if (pool == NULL) + return NULL; COMPUTE_DBG(rscreen, "* compute_memory_pool_new()\n"); @@ -64,6 +66,9 @@ static void compute_memory_pool_init(struct compute_memory_pool * pool, initial_size_in_dw); pool->shadow = (uint32_t*)CALLOC(initial_size_in_dw, 4); + if (pool->shadow == NULL) + return; + pool->next_id = 1; pool->size_in_dw = initial_size_in_dw; pool->bo = (struct r600_resource*)r600_compute_buffer_alloc_vram(pool->screen, @@ -400,6 +405,9 @@ struct compute_memory_item* compute_memory_alloc( new_item = (struct compute_memory_item *) CALLOC(sizeof(struct compute_memory_item), 1); + if (new_item == NULL) + return NULL; + new_item->size_in_dw = size_in_dw; new_item->start_in_dw = -1; /* mark pending */ new_item->id = pool->next_id++; |