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
main
Yanqin Jin 6 years ago committed by Facebook Github Bot
parent e264eebcd7
commit b5e4ee2e76
  1. 2
      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)

Loading…
Cancel
Save