diff --git a/Tools/XMLCoreParser/CMakeLists.txt b/Tools/XMLCoreParser/CMakeLists.txt
index ce03fc54ca30d720f6ac9911b6fc672ed9a61749..a47f651d44ba5b3979b82fe7261065e5d281dfb4 100644
--- a/Tools/XMLCoreParser/CMakeLists.txt
+++ b/Tools/XMLCoreParser/CMakeLists.txt
@@ -25,13 +25,15 @@ atlas_add_test( example1_test
                 SOURCES
                 test/example1_test.cxx
                 INCLUDE_DIRS ${EXPAT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${EXPAT_LIBRARIES} TestTools XMLCoreParser )
+                LINK_LIBRARIES ${EXPAT_LIBRARIES} TestTools XMLCoreParser
+                ENVIRONMENT "XMLCOREPARSER_DATA=${CMAKE_CURRENT_SOURCE_DIR}/data" )
 
 atlas_add_test( example2_test
                 SOURCES
                 test/example2_test.cxx
                 INCLUDE_DIRS ${EXPAT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${EXPAT_LIBRARIES} TestTools XMLCoreParser )
+                LINK_LIBRARIES ${EXPAT_LIBRARIES} TestTools XMLCoreParser
+                ENVIRONMENT "XMLCOREPARSER_DATA=${CMAKE_CURRENT_SOURCE_DIR}/data" )
 
 atlas_add_executable( example4
                       doc/example4.cxx
diff --git a/Tools/XMLCoreParser/cmt/requirements b/Tools/XMLCoreParser/cmt/requirements
index 617018498319c29e62004f5c7b62ca8b671ff0af..dee651ae9ca0c444a05004f7faf91b569d5b3c5a 100755
--- a/Tools/XMLCoreParser/cmt/requirements
+++ b/Tools/XMLCoreParser/cmt/requirements
@@ -31,5 +31,3 @@ macro texpatlinkopts "" WIN32 " $(cmt_installarea_linkopts) $(Expat_linkopts) "
 
 application texpat texpat.cxx DOMNode.cxx ExpatCoreParser.cxx 
 macro texpat_dependencies XMLCoreParser
-
-
diff --git a/Tools/XMLCoreParser/src/ExpatCoreParser.cxx b/Tools/XMLCoreParser/src/ExpatCoreParser.cxx
index d1dcd37d6f1aadc5c8a5295997e8504717444f8a..3b922d3c2780594bec6fad7973cdef9ee7e3c7eb 100755
--- a/Tools/XMLCoreParser/src/ExpatCoreParser.cxx
+++ b/Tools/XMLCoreParser/src/ExpatCoreParser.cxx
@@ -256,6 +256,10 @@ void ExpatCoreParser::do_comment (const XML_Char* s)
     {
       std::cout << "ExpatCoreParser::do_comment> s=" << s << " top=" << m_top << " last=" << m_last << " node=" << node << std::endl; 
     }
+
+  // Node is owned by m_last.
+  // cppcheck-suppress memleak
+  node = nullptr;
 }
 
 int ExpatCoreParser::generic_parse (XML_Parser p, const std::string& file_name)
diff --git a/Tools/XMLCoreParser/test/example1_test.cxx b/Tools/XMLCoreParser/test/example1_test.cxx
index 42786a80f4b2a73c9818f02feea8d78b4f2987d2..114d8216eadc46ca8661ffe04fb418e1c25ecf6e 100755
--- a/Tools/XMLCoreParser/test/example1_test.cxx
+++ b/Tools/XMLCoreParser/test/example1_test.cxx
@@ -16,9 +16,14 @@ int main (int argc, char* argv[])
   parser.register_external_entity ("LVL1Calorimeter", "NULL");
   parser.register_external_entity ("MuonSpectrometer", "NULL");
 
-  const char* file = "../data/ATLAS_AGDD.xml";
+  const char* dir = getenv("XMLCOREPARSER_DATA");
+  if (!dir)
+    dir = "../data";
+  std::string file = dir;
   if (argc > 1)
     file = argv[1]; 
+  else
+    file += "/ATLAS_AGDD.xml";
 
   parser.parse (file);
   return (0);
diff --git a/Tools/XMLCoreParser/test/example2_test.cxx b/Tools/XMLCoreParser/test/example2_test.cxx
index 2e495e7ff333427ab8774c2f2195d5f797636e63..a885d07997ce125861af3fe3c81a6ac8f1b46d07 100755
--- a/Tools/XMLCoreParser/test/example2_test.cxx
+++ b/Tools/XMLCoreParser/test/example2_test.cxx
@@ -48,9 +48,14 @@ int main (int argc, char* argv[])
   p.register_external_entity ("MuonSpectrometer", "NULL");
   p.register_external_entity ("MuonSpectrometer", "");
 
-  const char* file = "../data/ATLAS_AGDD.xml";
-  if (argc > 1) 
+  const char* dir = getenv("XMLCOREPARSER_DATA");
+  if (!dir)
+    dir = "../data";
+  std::string file = dir;
+  if (argc > 1)
     file = argv[1]; 
+  else
+    file += "/ATLAS_AGDD.xml";
  
   p.visit (file); 
   return (0);