Index: trunk/psLib/src/math/psPolynomial.c
===================================================================
--- trunk/psLib/src/math/psPolynomial.c	(revision 5090)
+++ trunk/psLib/src/math/psPolynomial.c	(revision 5091)
@@ -7,6 +7,6 @@
 *  polynomials.  It also contains a Gaussian functions.
 *
-*  @version $Revision: 1.123 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-09-22 02:47:16 $
+*  @version $Revision: 1.124 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-09-22 03:00:31 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -95,5 +95,5 @@
     unsigned int x = 0;
 
-    for (x = 0; x < poly->COOL_2D_nX; x++) {
+    for (x = 0; x < (1 + poly->COOL_2D_nX); x++) {
         psFree(poly->coeff[x]);
         psFree(poly->coeffErr[x]);
@@ -110,6 +110,6 @@
     unsigned int y = 0;
 
-    for (x = 0; x < poly->COOL_3D_nX; x++) {
-        for (y = 0; y < poly->COOL_3D_nY; y++) {
+    for (x = 0; x < (1 + poly->COOL_3D_nX); x++) {
+        for (y = 0; y < (1 + poly->COOL_3D_nY); y++) {
             psFree(poly->coeff[x][y]);
             psFree(poly->coeffErr[x][y]);
@@ -132,7 +132,7 @@
     unsigned int z = 0;
 
-    for (x = 0; x < poly->COOL_4D_nX; x++) {
-        for (y = 0; y < poly->COOL_4D_nY; y++) {
-            for (z = 0; z < poly->COOL_4D_nZ; z++) {
+    for (x = 0; x < (1 + poly->COOL_4D_nX); x++) {
+        for (y = 0; y < (1 + poly->COOL_4D_nY); y++) {
+            for (z = 0; z < (1 + poly->COOL_4D_nZ); z++) {
                 psFree(poly->coeff[x][y][z]);
                 psFree(poly->coeffErr[x][y][z]);
