From da10065d2b9b78fcb9446a4626343352cf30add0 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 26 Jul 2017 11:11:00 +1000 Subject: mesa: add NULL checking to free_shared_state() This will allow us to call this function from _mesa_alloc_shared_state() in the case that we run out of memory part way through allocating the state. Reviewed-by: Samuel Pitoiset --- src/mesa/main/texturebindless.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/texturebindless.c') diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c index cb95ed07c5a..f062ea904a1 100644 --- a/src/mesa/main/texturebindless.c +++ b/src/mesa/main/texturebindless.c @@ -394,8 +394,12 @@ _mesa_init_shared_handles(struct gl_shared_state *shared) void _mesa_free_shared_handles(struct gl_shared_state *shared) { - _mesa_hash_table_u64_destroy(shared->TextureHandles, NULL); - _mesa_hash_table_u64_destroy(shared->ImageHandles, NULL); + if (shared->TextureHandles) + _mesa_hash_table_u64_destroy(shared->TextureHandles, NULL); + + if (shared->ImageHandles) + _mesa_hash_table_u64_destroy(shared->ImageHandles, NULL); + mtx_destroy(&shared->HandlesMutex); } -- cgit v1.2.3