diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-10-02 00:22:34 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-10-02 00:22:34 +0000 |
commit | ebae424d2150b8850a101d3cf67e704318bb8089 (patch) | |
tree | 963a18feb0cbebde7552d81a299b9f8a27f78e83 | |
parent | 577d180669077dce86f3045ff6b1d708898bda3b (diff) | |
parent | cdb2c8f355e990aa5a958cf81c421544babb7889 (diff) | |
download | native-ebae424d2150b8850a101d3cf67e704318bb8089.tar.gz |
Merge "Make MemoryDealer::deallocate private" am: cdb2c8f355
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1843873
Change-Id: I60baab36cd83c51a6c464e9f9ccd924e0a64fa54
-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()); }, |