Skip to content

Commit 98d9cdd

Browse files
committed
Fix memory leak
1 parent a582505 commit 98d9cdd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ddsketch/test/StoreTest.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <climits>
2424
#include <map>
2525
#include <algorithm>
26+
#include <memory>
27+
#include <type_traits>
2628

2729
#include "collapsing_highest_dense_store.hpp"
2830
#include "store_factory.hpp"
@@ -175,7 +177,8 @@ void assert_encode_bins(StoreType& store, const std::vector<Bin>& normalized_bin
175177

176178
template<class StoreType>
177179
void test_copy(StoreType& store, const std::vector<Bin>& normalized_bins) {
178-
auto store_copy = store->copy();
180+
using StorePtr = std::unique_ptr<std::remove_pointer_t<decltype(store->copy())>>;
181+
StorePtr store_copy(store->copy());
179182
store->merge(*store_copy);
180183
assert_encode_bins(store_copy, normalized_bins);
181184
store->clear();

0 commit comments

Comments
 (0)