From 83a4dd1a67c9169b04f5a5dbce90c7999a2cfa46 Mon Sep 17 00:00:00 2001 From: Zhichao Cao Date: Wed, 24 Jun 2020 11:03:09 -0700 Subject: [PATCH] Fix the memory leak in Env_basic_test (#7017) Summary: Fix the memory leak broken asan and other test introduced by https://github.com/facebook/rocksdb/issues/6830 Pull Request resolved: https://github.com/facebook/rocksdb/pull/7017 Test Plan: pass asan_check Reviewed By: siying Differential Revision: D22190289 Pulled By: zhichao-cao fbshipit-source-id: 03a095f698b4f9d72fd9374191b17c890d7c2b56 --- env/env_basic_test.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/env/env_basic_test.cc b/env/env_basic_test.cc index 05173bae3..194853b67 100644 --- a/env/env_basic_test.cc +++ b/env/env_basic_test.cc @@ -97,8 +97,11 @@ static ROT13BlockCipher encrypt_block_rot13(32); static CTREncryptionProvider encrypt_provider_ctr(encrypt_block_rot13); -static std::unique_ptr encrypt_env(new NormalizingEnvWrapper( - NewEncryptedEnv(Env::Default(), &encrypt_provider_ctr))); +static std::unique_ptr ecpt_env(NewEncryptedEnv(Env::Default(), + &encrypt_provider_ctr)); + +static std::unique_ptr encrypt_env( + new NormalizingEnvWrapper(ecpt_env.get())); INSTANTIATE_TEST_CASE_P(EncryptedEnv, EnvBasicTestWithParam, ::testing::Values(encrypt_env.get())); INSTANTIATE_TEST_CASE_P(EncryptedEnv, EnvMoreTestWithParam,