Index: trunk/psModules/src/detrend/pmOverscan.c
===================================================================
--- trunk/psModules/src/detrend/pmOverscan.c	(revision 23826)
+++ trunk/psModules/src/detrend/pmOverscan.c	(revision 23989)
@@ -74,5 +74,8 @@
             mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0;
             ordinate->data.F32[i] = 2.0*(float)i/(float)pixels->n - 1.0; // Scale to [-1,1]
-            psVectorStats(myStats, values, NULL, NULL, 0);
+            if (!psVectorStats(myStats, values, NULL, NULL, 0)) {
+		psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+		return false;
+	    }
             reduced->data.F32[i] = psStatsGetValue(myStats, statistic);
         } else if (overscanOpts->fitType == PM_FIT_NONE) {
@@ -275,5 +278,8 @@
 	psFree(iter);
 
-	(void)psVectorStats(stats, pixels, NULL, NULL, 0);
+	if (!psVectorStats(stats, pixels, NULL, NULL, 0)) {
+	    psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+	    return false;
+	}
 	psFree(pixels);
 	double reduced = psStatsGetValue(stats, statistic); // Result of statistics
@@ -349,5 +355,8 @@
 	  psString comment = NULL;    // Comment to add
 	  psStats *vectorStats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
-	  psVectorStats (vectorStats, reduced, NULL, NULL, 0);
+	  if (!psVectorStats (vectorStats, reduced, NULL, NULL, 0)) {
+	      psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+	      return false;
+	  }
 	  psStringAppend(&comment, "Mean Overscan value: %f", vectorStats->sampleMean);
 	  psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
@@ -412,5 +421,8 @@
 	  psString comment = NULL;    // Comment to add
 	  psStats *vectorStats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
-	  psVectorStats (vectorStats, reduced, NULL, NULL, 0);
+	  if (!psVectorStats (vectorStats, reduced, NULL, NULL, 0)) {
+	      psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+	      return false;
+	  }
 	  psStringAppend(&comment, "Mean Overscan value: %f", vectorStats->sampleMean);
 	  psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
