Fix some errors detected by coverity scan

Summary: Nothing major, just an extra return line and posibility of leaking fb in NewRandomRWFile

Test Plan: make check

Reviewers: kailiu, dhruba

Reviewed By: kailiu

CC: leveldb

Differential Revision: https://reviews.facebook.net/D15993
This commit is contained in:
Igor Canadi 2014-02-06 21:59:44 -08:00
parent 1d08140e81
commit d53b188228
2 changed files with 4 additions and 5 deletions

View File

@ -349,7 +349,6 @@ inline bool BZip2_Compress(const CompressionOptions& opts, const char* input,
output->resize(output->size() - _stream.avail_out);
BZ2_bzCompressEnd(&_stream);
return true;
return output;
#endif
return false;
}

View File

@ -1047,16 +1047,16 @@ class PosixEnv : public Env {
unique_ptr<RandomRWFile>* result,
const EnvOptions& options) {
result->reset();
// no support for mmap yet
if (options.use_mmap_writes || options.use_mmap_reads) {
return Status::NotSupported("No support for mmap read/write yet");
}
Status s;
const int fd = open(fname.c_str(), O_CREAT | O_RDWR, 0644);
if (fd < 0) {
s = IOError(fname, errno);
} else {
SetFD_CLOEXEC(fd, &options);
// no support for mmap yet
if (options.use_mmap_writes || options.use_mmap_reads) {
return Status::NotSupported("No support for mmap read/write yet");
}
result->reset(new PosixRandomRWFile(fname, fd, options));
}
return s;