Skip to content

Commit 3f528a4

Browse files
committed
Fix memory leak
1 parent a582505 commit 3f528a4

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,7 @@ 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+
auto store_copy(store->copy());
179181
store->merge(*store_copy);
180182
assert_encode_bins(store_copy, normalized_bins);
181183
store->clear();
@@ -192,6 +194,7 @@ void test_copy(StoreType& store, const std::vector<Bin>& normalized_bins) {
192194
}
193195

194196
assert_encode_bins(store, normalized_bins);
197+
delete store_copy;
195198
}
196199

197200
template<class StoreType>

0 commit comments

Comments
 (0)