Index: trunk/psLib/src/math/psMinimizePolyFit.c
===================================================================
--- trunk/psLib/src/math/psMinimizePolyFit.c	(revision 41531)
+++ trunk/psLib/src/math/psMinimizePolyFit.c	(revision 41532)
@@ -19,4 +19,5 @@
  *  XXX: For clip-fit functions, what should we do if the mask is NULL?
  *
+ *  XXX: the sums are built for 2*(order + 1) elements, but it should be 2*order + 1
  */
 
@@ -2250,5 +2251,5 @@
         }
 
-        if (!psVectorStats (stats, resid, NULL, mask, maskValue)) {
+        if (!psVectorStats(stats, resid, NULL, mask, maskValue)) {
             psError(PS_ERR_UNKNOWN, false, "Could not compute statistics on the resid vector.  Returning NULL.\n");
             psFree(resid);
Index: trunk/psLib/src/sys/psThread.c
===================================================================
--- trunk/psLib/src/sys/psThread.c	(revision 41531)
+++ trunk/psLib/src/sys/psThread.c	(revision 41532)
@@ -296,4 +296,5 @@
     for (int i = 0; i < nThreads; i++) {
         psThread *thread = pool->data[i] = psThreadAlloc(); // Thread for pool
+	// XXX these threads are not destroyed, creating a minor leak
         if (pthread_create(&threads[i], NULL, psThreadLauncher, thread)) {
             psAbort("Unable to create thread");
Index: trunk/psLib/src/types/psMetadata.c
===================================================================
--- trunk/psLib/src/types/psMetadata.c	(revision 41531)
+++ trunk/psLib/src/types/psMetadata.c	(revision 41532)
@@ -1193,5 +1193,5 @@
         int regRtn = regcomp(newIter->regex, regex, 0);
         if (regRtn != 0) {
-            char errMsg[256];
+	    char errMsg[256]; // fixed buffer length should match in call below
             regerror(regRtn, newIter->regex, errMsg, 256);
             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
