diff options
| author | Stefan Boberg <[email protected]> | 2023-12-19 10:16:28 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-19 10:16:28 +0100 |
| commit | fc02c25257b5478ddd5d6c697b79df002da714fe (patch) | |
| tree | a62fa82ed381d55fd5b3b6fee034509b20177203 /src/zencore | |
| parent | cache RPC recorder threading fixes (#617) (diff) | |
| download | zen-fc02c25257b5478ddd5d6c697b79df002da714fe.tar.xz zen-fc02c25257b5478ddd5d6c697b79df002da714fe.zip | |
fix leak in IoBuffer for manifested small chunk (#618)
* fix leak in IoBuffer for manifested small chunk. previously it would null out the `m_DataPtr` member on every path from `IoBufferExtendedCore::~IoBufferExtendedCore()` but it only really makes sense to null it out when the buffer has been memory mapped
Diffstat (limited to 'src/zencore')
| -rw-r--r-- | src/zencore/iobuffer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/zencore/iobuffer.cpp b/src/zencore/iobuffer.cpp index 912f9ce4e..80d0f4ee4 100644 --- a/src/zencore/iobuffer.cpp +++ b/src/zencore/iobuffer.cpp @@ -209,6 +209,8 @@ IoBufferExtendedCore::~IoBufferExtendedCore() uint64_t MapSize = ~uint64_t(uintptr_t(m_MmapHandle)); munmap(m_MappedPointer, MapSize); #endif + + m_DataPtr = nullptr; // prevent any buffer deallocation attempts } const uint32_t LocalFlags = m_Flags.load(std::memory_order_relaxed); @@ -244,8 +246,6 @@ IoBufferExtendedCore::~IoBufferExtendedCore() ZEN_WARN("Error reported on file handle close, reason '{}'", GetLastErrorAsString()); } } - - m_DataPtr = nullptr; } static constexpr size_t MappingLockCount = 128; |