commit | eaddfa2f4be68b6a1d4ace2ffb61e15a5e830d70 | [log] [tgz] |
---|---|---|
author | Ankit Goyal <layog@google.com> | Mon Oct 18 17:32:23 2021 +0800 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Nov 02 13:45:17 2021 +0000 |
tree | 847c90fc56fb4fd59d53fc792c95d1b0c0b38d9e | |
parent | ba064b1afedd32978da042bbc51f084f7b25d8fa [diff] |
gralloc4: Delete the gralloc handle when freeing the buffer Bug: 199336554 Test: Do not observe leaks in heap profiling Change-Id: Iacab8555a1f425d7746fc7ab0937ddf9b1cf23d8 (cherry picked from commit 4ffbe198a4b30112aa2a29f709de0052750b53ca)
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 @@ 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 @@ 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 @@ { 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