mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-15 19:02:44 -05:00
replace new/delete with sp
This commit is contained in:
@@ -29,13 +29,13 @@
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static Storage<DnsUvBackend> *storage = nullptr;
|
||||
static std::shared_ptr<Storage<DnsUvBackend>> storage = nullptr;
|
||||
|
||||
|
||||
Storage<DnsUvBackend> &DnsUvBackend::getStorage()
|
||||
{
|
||||
if (storage == nullptr) {
|
||||
storage = new Storage<DnsUvBackend>();
|
||||
if (!storage) {
|
||||
storage = std::make_shared<Storage<DnsUvBackend>>();
|
||||
}
|
||||
|
||||
return *storage;
|
||||
@@ -67,8 +67,7 @@ xmrig::DnsUvBackend::~DnsUvBackend()
|
||||
storage->release(m_key);
|
||||
|
||||
if (storage->isEmpty()) {
|
||||
delete storage;
|
||||
storage = nullptr;
|
||||
storage.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user