diff --git a/db/db_test2.cc b/db/db_test2.cc index 59e264ef4..26da04417 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -1317,10 +1317,9 @@ TEST_F(DBTest2, CompressionFailures) { if (curr_compression_failure_type == kTestDecompressionCorruption) { BlockContents* contents = static_cast(arg); // Ensure uncompressed data != original data - std::unique_ptr fake_data( - new char[contents->data.size() + 1]); - *contents = - BlockContents(std::move(fake_data), contents->data.size() + 1); + const size_t len = contents->data.size() + 1; + std::unique_ptr fake_data(new char[len]()); + *contents = BlockContents(std::move(fake_data), len); } });