@@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
125
125
create_directories (ph);
126
126
127
127
// Set up a non-obfuscated wrapper to write some initial data.
128
- CDBWrapper* dbw = new CDBWrapper (ph, (1 << 10 ), false , false , false );
128
+ std::unique_ptr< CDBWrapper> dbw = std::unique_ptr<CDBWrapper>( new CDBWrapper (ph, (1 << 10 ), false , false , false ) );
129
129
char key = ' k' ;
130
130
uint256 in = InsecureRand256 ();
131
131
uint256 res;
@@ -135,8 +135,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
135
135
BOOST_CHECK_EQUAL (res.ToString (), in.ToString ());
136
136
137
137
// Call the destructor to free leveldb LOCK
138
- delete dbw;
139
- dbw = nullptr ;
138
+ dbw.reset ();
140
139
141
140
// Now, set up another wrapper that wants to obfuscate the same directory
142
141
CDBWrapper odbw (ph, (1 << 10 ), false , false , true );
@@ -167,7 +166,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
167
166
create_directories (ph);
168
167
169
168
// Set up a non-obfuscated wrapper to write some initial data.
170
- CDBWrapper* dbw = new CDBWrapper (ph, (1 << 10 ), false , false , false );
169
+ std::unique_ptr< CDBWrapper> dbw = std::unique_ptr<CDBWrapper>( new CDBWrapper (ph, (1 << 10 ), false , false , false ) );
171
170
char key = ' k' ;
172
171
uint256 in = InsecureRand256 ();
173
172
uint256 res;
@@ -177,8 +176,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
177
176
BOOST_CHECK_EQUAL (res.ToString (), in.ToString ());
178
177
179
178
// Call the destructor to free leveldb LOCK
180
- delete dbw;
181
- dbw = nullptr ;
179
+ dbw.reset ();
182
180
183
181
// Simulate a -reindex by wiping the existing data store
184
182
CDBWrapper odbw (ph, (1 << 10 ), false , true , true );
0 commit comments