From d53b18822834c5596f1bb3f5201dc566dfb5bd30 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 6 Feb 2014 21:59:44 -0800 Subject: [PATCH] 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 --- port/port_posix.h | 1 - util/env_posix.cc | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/port/port_posix.h b/port/port_posix.h index 8ff2480a3..839e89afe 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -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; } diff --git a/util/env_posix.cc b/util/env_posix.cc index b53cd0103..1ccb32084 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -1047,16 +1047,16 @@ class PosixEnv : public Env { unique_ptr* 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;