Index: trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- trunk/psLib/src/imageops/psImageStats.c	(revision 5090)
+++ trunk/psLib/src/imageops/psImageStats.c	(revision 5096)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-22 02:47:16 $
+ *  @version $Revision: 1.80 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-22 22:49:29 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -349,5 +349,5 @@
     // Free the Chebyshev polynomials that were
     // created in this routine.
-    for (i = 0; i < maxChebyPoly; i++) {
+    for (i = 0; i < maxChebyPoly + 1; i++) {
         psFree(chebPolys[i]);
     }
@@ -453,5 +453,5 @@
         maxChebyPoly = coeffs->COOL_2D_nY;
     }
-    chebPolys = 1 + p_psCreateChebyshevPolys(maxChebyPoly);
+    chebPolys = p_psCreateChebyshevPolys(maxChebyPoly + 1);
 
     // Compute the sums[][] data structure.
@@ -498,5 +498,5 @@
     // Free the Chebyshev polynomials that were
     // created in this routine.
-    for (i = 0; i < maxChebyPoly; i++) {
+    for (i = 0; i < maxChebyPoly + 1; i++) {
         psFree(chebPolys[i]);
     }
@@ -545,5 +545,5 @@
     }
 
-    chebPolys = 1 + p_psCreateChebyshevPolys(maxChebyPoly);
+    chebPolys = p_psCreateChebyshevPolys(maxChebyPoly + 1);
 
     for (x = 0; x < input->numRows; x++) {
@@ -574,5 +574,5 @@
     // created in this routine.
     // XXX: Use static data structures here.
-    for (i = 0; i < maxChebyPoly; i++) {
+    for (i = 0; i < maxChebyPoly + 1; i++) {
         psFree(chebPolys[i]);
     }
