diff --git a/SystemTools.cxx b/SystemTools.cxx
index 82087f0608d747927e2cdf778321d40119864c3d..f74960d90697ba9911f0b83bb6a40856fd4fb177 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -4491,19 +4491,13 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
 bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
-  const int size = int(path.size()) +1; // size of return
-  char *tempPath = new char[size];  // create a buffer
+  std::string tempPath = path;  // create a buffer
   DWORD ret;
 
   // if the path passed in has quotes around it, first remove the quotes
   if (!path.empty() && path[0] == '"' && *path.rbegin() == '"')
     {
-    strcpy(tempPath,path.c_str()+1);
-    tempPath[size-2] = '\0';
-    }
-  else
-    {
-    strcpy(tempPath,path.c_str());
+    tempPath = path.substr(1, path.length()-2);
     }
 
   std::wstring wtempPath = Encoding::ToWide(tempPath);
@@ -4514,13 +4508,11 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
 
   if(buffer[0] == 0 || ret > wtempPath.size())
     {
-    delete [] tempPath;
     return false;
     }
   else
     {
     shortPath = Encoding::ToNarrow(&buffer[0]);
-    delete [] tempPath;
     return true;
     }
 #else