fix mmap fd leak inn HIDL audio stream
Do not dup the fd received from HAL in StreamHalHidl::createMmapBuffer()
Bug: 38232872
Test: verify that MMAP streams can be opened and closed multiple times
Change-Id: I4813f78bd1ae1e8c705d1769a59710c9437bf246
diff --git a/media/libaudiohal/StreamHalHidl.cpp b/media/libaudiohal/StreamHalHidl.cpp
index 5b06b73..42785d5 100644
--- a/media/libaudiohal/StreamHalHidl.cpp
+++ b/media/libaudiohal/StreamHalHidl.cpp
@@ -158,7 +158,7 @@
if (retval == Result::OK) {
const native_handle *handle = hidlInfo.sharedMemory.handle();
if (handle->numFds > 0) {
- info->shared_memory_fd = dup(handle->data[0]);
+ info->shared_memory_fd = handle->data[0];
info->buffer_size_frames = hidlInfo.bufferSizeFrames;
info->burst_size_frames = hidlInfo.burstSizeFrames;
// info->shared_memory_address is not needed in HIDL context