Index: trunk/psLib/src/math/psMinimizePolyFit.c
===================================================================
--- trunk/psLib/src/math/psMinimizePolyFit.c	(revision 11674)
+++ trunk/psLib/src/math/psMinimizePolyFit.c	(revision 13396)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-07 01:15:49 $
+ *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-16 16:16:48 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -842,4 +842,6 @@
                 psFree(x);
             }
+	    psFree(resid);
+	    
             return false;
         }
@@ -848,4 +850,7 @@
         if (fit == NULL) {
             psError(PS_ERR_UNKNOWN, false, "Could not call psPolynomial3DEvalVector().  Returning false.\n");
+            if (xIn == NULL) {
+                psFree(x);
+            }
             psFree(resid);
             return false;
