diff --git a/base/include/singleton.h b/base/include/singleton.h index b831f9032d652534a1227675a51b22bc43c32c9e..8a1320bc24ad2a8b7e95b4c19e2ddfbbab43bf01 100644 --- a/base/include/singleton.h +++ b/base/include/singleton.h @@ -68,7 +68,7 @@ std::shared_ptr DelayedSingleton::GetInstance() if (instance_ == nullptr) { std::lock_guard lock(mutex_); if (instance_ == nullptr) { - std::shared_ptr temp(new T); + std::shared_ptr temp(new (std::nothrow) T); instance_ = temp; } } diff --git a/base/include/thread_pool.h b/base/include/thread_pool.h index 06bac4e5292fb21f3e03a6fff3db447d147ca24e..66c7907e022bacb4b2defd8a3fe4851df726cc3a 100644 --- a/base/include/thread_pool.h +++ b/base/include/thread_pool.h @@ -37,7 +37,7 @@ public: // is restricted to 16 characters, including the terminating null byte ('\0'). // Please pay attention to the length of name(args here). explicit ThreadPool(const std::string &name = std::string()); - ~ThreadPool () override; + ~ThreadPool() override; uint32_t Start(int threadsNum); void Stop();