summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Luis A. Lozano <llozano@google.com> 2017-10-12 20:24:39 +0000
committer android-build-merger <android-build-merger@google.com> 2017-10-12 20:24:39 +0000
commita85ce1192fad0170667024a4b5d41280104f5efb (patch)
treec2482b2c6889ef933a14f94cfa92e761ba28256e
parent5e931d888832f02384f9e16d46637ac745a688cd (diff)
parent85d08b12e18d012b2a273e21e1d54eb6af17c060 (diff)
Merge "Fix "use of memory after freed" warning." am: 3f5160cadc am: db5075c9db
am: 85d08b12e1 Change-Id: I8bf97ed0e72c92c93b4e86f0b2f660e3b71ac06e
-rw-r--r--libs/binder/MemoryDealer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp
index 2a15773aa3..1cfe02a3fe 100644
--- a/libs/binder/MemoryDealer.cpp
+++ b/libs/binder/MemoryDealer.cpp
@@ -289,7 +289,15 @@ SimpleBestFitAllocator::SimpleBestFitAllocator(size_t size)
SimpleBestFitAllocator::~SimpleBestFitAllocator()
{
while(!mList.isEmpty()) {
- delete mList.remove(mList.head());
+ chunk_t* removed = mList.remove(mList.head());
+#ifdef __clang_analyzer__
+ // Clang static analyzer gets confused in this loop
+ // and generates a false positive warning about accessing
+ // memory that is already freed.
+ // Add an "assert" to avoid the confusion.
+ LOG_ALWAYS_FATAL_IF(mList.head() == removed);
+#endif
+ delete removed;
}
}