From 2e97c38980a445bd824f5dd67b1850966405539c Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Thu, 4 Sep 2014 23:11:28 -0700 Subject: [PATCH 1/5] Avoid off-by-one error when using readlink --- port/stack_trace.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/port/stack_trace.cc b/port/stack_trace.cc index 76866e63cc..296b1f6209 100644 --- a/port/stack_trace.cc +++ b/port/stack_trace.cc @@ -33,7 +33,7 @@ const char* GetExecutableName() { char link[1024]; snprintf(link, sizeof(link), "/proc/%d/exe", getpid()); - auto read = readlink(link, name, sizeof(name)); + auto read = readlink(link, name, sizeof(name) - 1); if (-1 == read) { return nullptr; } else { From d40c1f742ff9cbbb7c6dc1a582c2937b142862d2 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Fri, 5 Sep 2014 14:14:30 -0700 Subject: [PATCH 2/5] Add missing break statement --- utilities/spatialdb/spatial_db.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/utilities/spatialdb/spatial_db.cc b/utilities/spatialdb/spatial_db.cc index 21a111d3eb..f0aed8faaa 100644 --- a/utilities/spatialdb/spatial_db.cc +++ b/utilities/spatialdb/spatial_db.cc @@ -221,6 +221,7 @@ std::string FeatureSet::DebugString() const { switch (iter.second.type()) { case Variant::kNull: out.append("null"); + break; case Variant::kBool: if (iter.second.get_bool()) { out.append("true"); From bfee319fb08ab057ec07b250336afa703b63bc7f Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Fri, 5 Sep 2014 16:07:14 -0700 Subject: [PATCH 3/5] sizeof(int*) where sizeof(int) was intended --- util/hash_cuckoo_rep.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/hash_cuckoo_rep.cc b/util/hash_cuckoo_rep.cc index a9a79a2742..2ee05faac5 100644 --- a/util/hash_cuckoo_rep.cc +++ b/util/hash_cuckoo_rep.cc @@ -70,7 +70,7 @@ class HashCuckooRep : public MemTableRep { } cuckoo_path_ = reinterpret_cast( - arena_->Allocate(sizeof(int*) * (cuckoo_path_max_depth_ + 1))); + arena_->Allocate(sizeof(int) * (cuckoo_path_max_depth_ + 1))); is_nearly_full_ = false; } From d1cfb71ec7f91ef317b56a2423305b90003bcb66 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Fri, 5 Sep 2014 20:47:10 -0700 Subject: [PATCH 4/5] Remove unused member(s) --- include/rocksdb/cache.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/rocksdb/cache.h b/include/rocksdb/cache.h index 65d44b6cbf..a8a6f9b73a 100644 --- a/include/rocksdb/cache.h +++ b/include/rocksdb/cache.h @@ -127,9 +127,6 @@ class Cache { void LRU_Append(Handle* e); void Unref(Handle* e); - struct Rep; - Rep* rep_; - // No copying allowed Cache(const Cache&); void operator=(const Cache&); From 9f8aa0939529f1c6f7ba752968e638429074425c Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Fri, 5 Sep 2014 20:47:57 -0700 Subject: [PATCH 5/5] Don't leak data returned by opendir --- util/ldb_cmd.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index aef84fa356..53e15e0ba4 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -541,6 +541,7 @@ void ManifestDumpCommand::DoCommand() { } else { exec_state_ = LDBCommandExecuteResult::FAILED( "Multiple MANIFEST files found; use --path to select one"); + closedir(d); return; } }