diff --git a/SystemTools.cxx b/SystemTools.cxx
index c3290456bd92d8d169680698b39105f6653bf2eb..bd24f114ffb6ce4ad3cf24e36b01e875dcce4ee8 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -1756,6 +1756,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative,
 void SystemTools::SplitPath(const char* p,
                             kwsys_stl::vector<kwsys_stl::string>& components)
 {
+  components.clear();
   // Identify the root component.
   const char* c = p;
   if(c[0] == '/' && c[1] == '/')