From 59cc490cd6db5525e8ef18f703c11eedb3d06fe6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 3 Jan 2021 19:47:51 +0000 Subject: No naked new/delete in unit tests --- netfs/unittests/mockDaemon.cpp | 3 +-- netfs/unittests/mockDaemon.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp index 0cb3172..1ccd6b7 100644 --- a/netfs/unittests/mockDaemon.cpp +++ b/netfs/unittests/mockDaemon.cpp @@ -36,7 +36,6 @@ MockDaemonHost::stop() { if (daemon) { daemon->stop(); - delete daemon; } if (ic) { ic->destroy(); @@ -51,7 +50,7 @@ MockDaemonHost::start() id.properties->parseCommandLineOptions("", params); ic = Ice::initialize(id); ic->getProperties()->setProperty("NetFSD.HostNameOverride", "unittest"); - daemon = new MockDaemon(testEndpoint); + daemon = std::make_unique(testEndpoint); daemon->start("NetFSDaemonAdapter", ic, {}); } diff --git a/netfs/unittests/mockDaemon.h b/netfs/unittests/mockDaemon.h index fb129c4..8bc6097 100644 --- a/netfs/unittests/mockDaemon.h +++ b/netfs/unittests/mockDaemon.h @@ -33,7 +33,7 @@ private: const std::string testEndpoint; Ice::StringSeq params; - NetFSDaemon * daemon; + std::unique_ptr daemon; }; #endif -- cgit v1.2.3