diff --git a/src/ADDHCmd.cpp b/src/ADDHCmd.cpp
index 791582256dc21b4d9163915684ee51454085b51e..3608b122329b7b7b243eeb04415e027fc313402d 100644
--- a/src/ADDHCmd.cpp
+++ b/src/ADDHCmd.cpp
@@ -31,8 +31,7 @@ ADDHCmd::ADDHCmd() :
     char hostname[_SC_HOST_NAME_MAX];
     gethostname(hostname, _SC_HOST_NAME_MAX);
     std::string hostnameString(hostname);
-    this->m_filePathPrefix = Config::instance().getValue("outputDirPrefix",
-                                                         std::string());
+    this->m_filePathPrefix = Config::instance().getValue("outputDirPrefix", "");
 }
 
 ADDHCmd::~ADDHCmd() {}
@@ -95,23 +94,27 @@ void ADDHCmd::commandReceived(ntof::dim::DIMCmd &cmdData)
 bool ADDHCmd::isValidPath(const std::string &filePath,
                           const std::string &m_filePathPrefix)
 {
-    bfs::path absPath = filePath;
-    if (filePath[0] != '/')
+    if (m_filePathPrefix != "")
     {
-        // filePath is relative, convert to m_filePathPrefix/filePath form
-        absPath = m_filePathPrefix + "/" + filePath;
-    }
-    try
-    {
-        absPath = bfs::canonical(absPath).string();
-    }
-    catch (std::exception const &e)
-    {
-        // No such file or directory
-        return false;
+        bfs::path absPath = filePath;
+        if (filePath[0] != '/')
+        {
+            // filePath is relative, convert to m_filePathPrefix/filePath form
+            absPath = m_filePathPrefix + "/" + filePath;
+        }
+        try
+        {
+            absPath = bfs::canonical(absPath).string();
+        }
+        catch (std::exception const &e)
+        {
+            // No such file or directory
+            return false;
+        }
+        return (absPath.string().compare(0, m_filePathPrefix.length(),
+                                         m_filePathPrefix) == 0);
     }
-    return (absPath.string().compare(0, m_filePathPrefix.length(),
-                                     m_filePathPrefix) == 0);
+    return true;
 }
 
 } // namespace addh
diff --git a/tests/test_ADDHCmd.cpp b/tests/test_ADDHCmd.cpp
index 14d419712ee3a140937b81578eb0de87d5f0ed5d..9a67c42b8aba6829e53b51290fa6624968093369 100644
--- a/tests/test_ADDHCmd.cpp
+++ b/tests/test_ADDHCmd.cpp
@@ -77,7 +77,7 @@ public:
 
     void validatePathCheck()
     {
-        ADDHCmd *addhCmd_ = new ADDHCmd();
+        std::shared_ptr<ADDHCmd> addhCmd_(new ADDHCmd);
 
         bfs::path correct_prefixed_path = m_correct_prefix_dir / "correct_path";
         bfs::create_directories(correct_prefixed_path);
@@ -115,8 +115,6 @@ public:
         EQ(false,
            addhCmd_->isValidPath(correct_prefixed_path.string() + "/../..",
                                  m_correct_prefix_dir.string()));
-
-        delete addhCmd_;
     }
 };