Index: trunk/ppStack/src/ppStackLoop.c
===================================================================
--- trunk/ppStack/src/ppStackLoop.c	(revision 19756)
+++ trunk/ppStack/src/ppStackLoop.c	(revision 19770)
@@ -6,4 +6,5 @@
 #include <unistd.h>
 #include <string.h>
+#include <libgen.h>
 #include <pslib.h>
 #include <psmodules.h>
@@ -193,6 +194,7 @@
         return false;
     }
-    const char *tempName = psMetadataLookupStr(NULL, config->arguments, "OUTPUT"); // Name for temporary files
-    tempName = basename(tempName);
+
+    psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments, "OUTPUT")); // Name for temporary files
+    const char *tempName = basename(outputName);
     if (!tempName) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files.");
@@ -393,4 +395,6 @@
         weightNames->data[i] = weightName;
     }
+    // Free the outputName that we grabbed above to set up tempName.
+    psFree(outputName);
 
     // Generate convolutions and write them to disk
