gralloc: Fix race condition in gralloc
- Add mutex lock while accessing handles_map
CRs-Fixed: 2230720
Change-Id: Ibbe77e87020e655f6ebeb2428a13555460b3ac7d
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp
index 3d4bfac..a569184 100644
--- a/gralloc/gr_buf_mgr.cpp
+++ b/gralloc/gr_buf_mgr.cpp
@@ -335,6 +335,7 @@
}
Error BufferManager::Dump(std::ostringstream *os) {
+ std::lock_guard<std::mutex> buffer_lock(buffer_lock_);
for (auto it : handles_map_) {
auto buf = it.second;
auto hnd = buf->handle;