diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-10-02 00:03:20 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-10-02 00:03:20 +0000 |
commit | cdb2c8f355e990aa5a958cf81c421544babb7889 (patch) | |
tree | 95a926b7339565eba541d84910d889630a4b3d9f | |
parent | b935f15830b18ca88764684c5f9ec4967c7f616e (diff) | |
parent | 94f0df2de89e4d18df1212d3668abc8053ca9f8b (diff) | |
download | native-cdb2c8f355e990aa5a958cf81c421544babb7889.tar.gz |
Merge "Make MemoryDealer::deallocate private"
-rw-r--r-- | libs/binder/include/binder/MemoryDealer.h | 3 | ||||
-rw-r--r-- | libs/binder/tests/unit_fuzzers/MemoryDealerFuzz.cpp | 9 |
2 files changed, 2 insertions, 10 deletions
diff --git a/libs/binder/include/binder/MemoryDealer.h b/libs/binder/include/binder/MemoryDealer.h index e72777252a..3f7dd11933 100644 --- a/libs/binder/include/binder/MemoryDealer.h +++ b/libs/binder/include/binder/MemoryDealer.h @@ -36,7 +36,6 @@ public: uint32_t flags = 0 /* or bits such as MemoryHeapBase::READ_ONLY */ ); virtual sp<IMemory> allocate(size_t size); - virtual void deallocate(size_t offset); virtual void dump(const char* what) const; // allocations are aligned to some value. return that value so clients can account for it. @@ -48,6 +47,8 @@ protected: virtual ~MemoryDealer(); private: + friend class Allocation; + virtual void deallocate(size_t offset); const sp<IMemoryHeap>& heap() const; SimpleBestFitAllocator* allocator() const; diff --git a/libs/binder/tests/unit_fuzzers/MemoryDealerFuzz.cpp b/libs/binder/tests/unit_fuzzers/MemoryDealerFuzz.cpp index f9dda8c558..f5e3af51e3 100644 --- a/libs/binder/tests/unit_fuzzers/MemoryDealerFuzz.cpp +++ b/libs/binder/tests/unit_fuzzers/MemoryDealerFuzz.cpp @@ -46,15 +46,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { [&]() -> void { dealer->getAllocationAlignment(); }, [&]() -> void { dealer->getMemoryHeap(); }, [&]() -> void { - size_t offset = fdp.ConsumeIntegral<size_t>(); - - // Offset has already been freed, so return instead. - if (free_list.find(offset) != free_list.end()) return; - - dealer->deallocate(offset); - free_list.insert(offset); - }, - [&]() -> void { std::string randString = fdp.ConsumeRandomLengthString(fdp.remaining_bytes()); dealer->dump(randString.c_str()); }, |