Index: trunk/psModules/src/config/pmConfig.c
===================================================================
--- trunk/psModules/src/config/pmConfig.c	(revision 15513)
+++ trunk/psModules/src/config/pmConfig.c	(revision 15525)
@@ -551,11 +551,16 @@
 
     psString path = psMetadataLookupStr(NULL, config->site, "PATH");
+    psString newPath = NULL;            // New path
+    // The following gymnastics with 'newPath' are required to avoid changing the pointer out from under the
+    // psMetadataItem on which 'path' sits (leading to memory corruption because it no longer points to valid
+    // memory).
     if (path) {
-        psStringAppend(&path, ":%s", siteNameDir);
+        psStringAppend(&newPath, "%s:%s", path, siteNameDir);
     } else {
-        path = psMemIncrRefCounter(siteNameDir);
-    }
-    pmConfigSet(path);
+        newPath = psMemIncrRefCounter(siteNameDir);
+    }
     psFree(siteNameDir);
+    pmConfigSet(newPath);
+    psFree(newPath);
 
     // Next, we do a similar thing for the camera configuration file.  The
