Skip to content

Commit 0fbb3fa

Browse files
author
Raghav Pisolkar
committed
fixed memory leak in unit test DBIteratorBoundTest
Summary: fixed memory leak in unit test DBIteratorBoundTest Test Plan: ran valgrind test on my unit test Reviewers: sdong Differential Revision: https://reviews.facebook.net/D22911
1 parent adcd253 commit 0fbb3fa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

db/db_test.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -7791,7 +7791,8 @@ TEST(DBTest, DBIteratorBoundTest) {
77917791
{
77927792
ReadOptions ro;
77937793
// iterate_upper_bound points beyond the last expected entry
7794-
ro.iterate_upper_bound = new Slice("foo2");
7794+
Slice prefix("foo2");
7795+
ro.iterate_upper_bound = &prefix;
77957796

77967797
std::unique_ptr<Iterator> iter(db_->NewIterator(ro));
77977798

@@ -7823,7 +7824,8 @@ TEST(DBTest, DBIteratorBoundTest) {
78237824
// This should be an error
78247825
{
78257826
ReadOptions ro;
7826-
ro.iterate_upper_bound = new Slice("g1");
7827+
Slice prefix("g1");
7828+
ro.iterate_upper_bound = &prefix;
78277829

78287830
std::unique_ptr<Iterator> iter(db_->NewIterator(ro));
78297831

@@ -7868,7 +7870,8 @@ TEST(DBTest, DBIteratorBoundTest) {
78687870
ASSERT_EQ(static_cast<int>(perf_context.internal_delete_skipped_count), 2);
78697871

78707872
// now testing with iterate_bound
7871-
ro.iterate_upper_bound = new Slice("c");
7873+
Slice prefix("c");
7874+
ro.iterate_upper_bound = &prefix;
78727875

78737876
iter.reset(db_->NewIterator(ro));
78747877

0 commit comments

Comments
 (0)