diff --git a/db/db_test_util.h b/db/db_test_util.h index df1e7cfb2d..f9d1eca3f5 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -606,7 +606,7 @@ class MockTimeEnv : public EnvWrapper { } private: - uint64_t current_time_ = 0; + std::atomic current_time_{0}; }; #ifndef ROCKSDB_LITE diff --git a/util/status.cc b/util/status.cc index 1881c58de0..319b0d9a4e 100644 --- a/util/status.cc +++ b/util/status.cc @@ -15,10 +15,11 @@ namespace rocksdb { const char* Status::CopyState(const char* state) { - const size_t cch = + const size_t cch = std::strlen(state) + 1; // +1 for the null terminator char* const result = - new char[cch]; + new char[cch]; + result[cch - 1] = '\0'; #ifdef OS_WIN errno_t ret; ret = strncpy_s(result, cch, state, cch - 1);