From 041cfdf2cfeb413f415bc2e7dd7f40638d5de65e Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 28 Jul 2010 18:12:39 -0700 Subject: [PATCH] fix [2855380] GRG19 monkey native crash in GraphicBufferAllocator we were dereferencing the null pointer when freeing ashmem buffers. Change-Id: I7be6e1ae064148bea1076193c21a73b5a3f90297 --- libgralloc-qsd8k/gpu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp index bcca1eb..a5c7442 100644 --- a/libgralloc-qsd8k/gpu.cpp +++ b/libgralloc-qsd8k/gpu.cpp @@ -282,8 +282,10 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) { } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP) { pmem_allocator = &pmemAdspAllocator; } - pmem_allocator->free_pmem_buffer(hnd->size, (void*)hnd->base, - hnd->offset, hnd->fd); + if (pmem_allocator) { + pmem_allocator->free_pmem_buffer(hnd->size, (void*)hnd->base, + hnd->offset, hnd->fd); + } deps.terminateBuffer(&m->base, const_cast(hnd)); }