Android 12.0.0 release 0.17
Buffer: Correctly disenroll buffer to avoid memory leaks

After pa/1974512 is in, one buffer can be enrolled several times
buffer is identified by vaddr. So when buffer->enrollment_list->list
is empty, we should delete the hashmap node because there is no buffer
enrollment anymore. Otherwise, if it's not empty, we need to keep the
buffer node.
The real buffer leakage is we didn't free the enrollment_list
has been allocated.
Add kfree(buffer->enrollment_list) into buffer disenrollment to
fix memory leakage.

Bug: 199806521
Test:, CTS, GCA
Signed-off-by: Nick Chung <>
Change-Id: Id5904cff1f7f6d6392ff203e144479be7df1c73f
(cherry picked from commit ab45d0cda10ab5aa70616b96b0db26295ab606ad)
1 file changed