From b5e4ee2e763789e23ee2e31e8fc8f82916bafc2d Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Tue, 28 May 2019 12:16:22 -0700 Subject: [PATCH] Fix a clang analyze error (#5365) Summary: The analyzer thinks max_allowed_ space can be 0. In that case, free_space will be assigned as free_space. It fails to realize that the function call GetFreeSpace actually sets the free_space variable properly, which is possibly due to lack of inter-function call analysis. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5365 Differential Revision: D15521790 Pulled By: riversand963 fbshipit-source-id: 839d0a285a1c8773a28a385f0c3be4bb7fbe32cb --- util/sst_file_manager_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sst_file_manager_impl.cc b/util/sst_file_manager_impl.cc index 047b0c093..d85b9c960 100644 --- a/util/sst_file_manager_impl.cc +++ b/util/sst_file_manager_impl.cc @@ -264,7 +264,7 @@ void SstFileManagerImpl::ClearError() { return; } - uint64_t free_space; + uint64_t free_space = 0; Status s = env_->GetFreeSpace(path_, &free_space); free_space = max_allowed_space_ > 0 ? std::min(max_allowed_space_, free_space)