From a4caa79e5558215e0b975e00e7660915b757f761 Mon Sep 17 00:00:00 2001 From: Zackliu <1049604063@qq.com> Date: Fri, 21 Nov 2025 01:23:13 +0000 Subject: [PATCH] fix memory leakage --- cpp/runtime/state/rocksdb/RocksdbMapStateTable.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpp/runtime/state/rocksdb/RocksdbMapStateTable.h b/cpp/runtime/state/rocksdb/RocksdbMapStateTable.h index 9697338..c4b152b 100644 --- a/cpp/runtime/state/rocksdb/RocksdbMapStateTable.h +++ b/cpp/runtime/state/rocksdb/RocksdbMapStateTable.h @@ -121,7 +121,11 @@ public: if constexpr (std::is_pointer_v) { return (UV)resPtr; } else { - return *(UV *)resPtr; // attention: need to delete restPtr in the caller after using + UV value = *(UV*)resPtr; + delete (UV*)resPtr; + return value; + + // return *(UV *)resPtr; // attention: need to delete restPtr in the caller after using } } }; @@ -881,4 +885,4 @@ std::vector> *RocksdbMapStateTable::getKeysAndNam return nullptr; } -#endif // OMNISTREAM_ROCKSDBMAPSTATETABLE_H \ No newline at end of file +#endif // OMNISTREAM_ROCKSDBMAPSTATETABLE_H -- Gitee