diff options
author | Ankit Goyal <layog@google.com> | 2021-10-18 17:32:23 +0800 |
---|---|---|
committer | Ankit Goyal <layog@google.com> | 2021-10-18 17:37:46 +0800 |
commit | 4ffbe198a4b30112aa2a29f709de0052750b53ca (patch) | |
tree | 847c90fc56fb4fd59d53fc792c95d1b0c0b38d9e | |
parent | 03316c5e63d1db54ae060c2f4212868e40fcb0dc (diff) | |
download | gchips-4ffbe198a4b30112aa2a29f709de0052750b53ca.tar.gz |
gralloc4: Delete the gralloc handle when freeing the buffer
Bug: 199336554
Test: Do not observe leaks in heap profiling
Change-Id: Iacab8555a1f425d7746fc7ab0937ddf9b1cf23d8
-rw-r--r-- | gralloc4/src/allocator/mali_gralloc_ion.cpp | 1 | ||||
-rw-r--r-- | gralloc4/src/core/mali_gralloc_bufferallocation.cpp | 2 | ||||
-rw-r--r-- | gralloc4/src/core/mali_gralloc_reference.cpp | 2 |
3 files changed, 2 insertions, 3 deletions
diff --git a/gralloc4/src/allocator/mali_gralloc_ion.cpp b/gralloc4/src/allocator/mali_gralloc_ion.cpp index dd003c9..4b96743 100644 --- a/gralloc4/src/allocator/mali_gralloc_ion.cpp +++ b/gralloc4/src/allocator/mali_gralloc_ion.cpp @@ -523,6 +523,7 @@ void mali_gralloc_ion_free(private_handle_t * const hnd) hnd->fds[i] = -1; hnd->bases[i] = 0; } + delete hnd; } static void mali_gralloc_ion_free_internal(buffer_handle_t * const pHandle, diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp index e928637..c0f1549 100644 --- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp +++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp @@ -1150,8 +1150,8 @@ int mali_gralloc_buffer_free(buffer_handle_t pHandle) return -1; } - mali_gralloc_ion_free(hnd); gralloc_shared_memory_free(hnd); + mali_gralloc_ion_free(hnd); return 0; } diff --git a/gralloc4/src/core/mali_gralloc_reference.cpp b/gralloc4/src/core/mali_gralloc_reference.cpp index 57b8f73..880f838 100644 --- a/gralloc4/src/core/mali_gralloc_reference.cpp +++ b/gralloc4/src/core/mali_gralloc_reference.cpp @@ -116,8 +116,6 @@ int mali_gralloc_reference_release(buffer_handle_t handle, bool canFree) { mali_gralloc_dump_buffer_erase(hnd); mali_gralloc_buffer_free(handle); - delete handle; - } } else if (hnd->remote_pid == getpid()) // never unmap buffers that were not imported into this process |