Index: trunk/psLib/src/dataManip/psFFT.c
===================================================================
--- trunk/psLib/src/dataManip/psFFT.c	(revision 1071)
+++ trunk/psLib/src/dataManip/psFFT.c	(revision 1073)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-12 02:17:25 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-23 23:00:15 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -35,5 +35,5 @@
     /* got good image data? */
     if (in==NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -44,5 +44,5 @@
         psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -51,5 +51,5 @@
         psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
 
@@ -76,5 +76,5 @@
     if (plan == NULL) {
         psError(__func__,"Failed to create FFTW plan.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -98,5 +98,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -143,5 +143,5 @@
         psError(__func__,"Can not extract real component from given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -158,5 +158,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -205,5 +205,5 @@
         psError(__func__,"Can not extract imaginary component from given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -220,5 +220,5 @@
 
     if (real == NULL || imag == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -230,5 +230,5 @@
     if (imag->type.type != type) {
         psError(__func__,"The inputs to psImageComplex must be the same type.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -237,5 +237,5 @@
             imag->numRows != numRows) {
         psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -243,5 +243,5 @@
     if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"The inputs to psImageComplex can not be complex.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -249,5 +249,5 @@
     if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
         psError(__func__,"The input type to psImageComplex must be a floating point.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -287,5 +287,5 @@
         psError(__func__,"Can not merge real and imaginary portions for given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -302,5 +302,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -347,5 +347,5 @@
         psError(__func__,"Can not compute complex conjugate for given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -362,5 +362,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -374,5 +374,5 @@
     if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -417,5 +417,5 @@
         psError(__func__,"Can not power spectrum for given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -435,5 +435,5 @@
     /* got good image data? */
     if (in==NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -444,5 +444,5 @@
         psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -451,5 +451,5 @@
         psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
 
@@ -491,5 +491,5 @@
     if (plan == NULL) {
         psError(__func__,"Failed to create FFTW plan.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -510,5 +510,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -542,5 +542,5 @@
         psError(__func__,"Can not extract real component from given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -556,5 +556,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -588,5 +588,5 @@
         psError(__func__,"Can not extract imaginary component from given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -602,5 +602,5 @@
 
     if (real == NULL || imag == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -615,5 +615,5 @@
     if (imag->type.type != type) {
         psError(__func__,"The inputs to psVectorComplex must be the same type.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -621,5 +621,5 @@
     if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"The inputs to psVectorComplex can not be complex.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -640,5 +640,5 @@
         psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -654,5 +654,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -687,5 +687,5 @@
         psError(__func__,"Can not compute complex conjugate for given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -703,5 +703,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -716,5 +716,5 @@
     if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -747,9 +747,9 @@
         psError(__func__,"Can not power spectrum for given vector type (%d).",
                 type);
-        psVectorFree(out);
-        return NULL;
-    }
-
-    return out;
-
-}
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
Index: trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- trunk/psLib/src/dataManip/psFunctions.c	(revision 1071)
+++ trunk/psLib/src/dataManip/psFunctions.c	(revision 1073)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-14 19:40:14 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-23 23:00:15 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -34,4 +34,14 @@
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_randist.h>
+
+static void polynomial1DFree(psPolynomial1D *myPoly);
+static void polynomial2DFree(psPolynomial2D *myPoly);
+static void polynomial3DFree(psPolynomial3D *myPoly);
+static void polynomial4DFree(psPolynomial4D *myPoly);
+static void dPolynomial1DFree(psDPolynomial1D *myPoly);
+static void dPolynomial2DFree(psDPolynomial2D *myPoly);
+static void dPolynomial3DFree(psDPolynomial3D *myPoly);
+static void dPolynomial4DFree(psDPolynomial4D *myPoly);
+
 /*****************************************************************************/
 /*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
@@ -108,4 +118,5 @@
 
     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
     newPoly->n = n;
     newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
@@ -128,4 +139,5 @@
 
     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
@@ -158,4 +170,5 @@
 
     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
@@ -197,4 +210,5 @@
 
     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -235,13 +249,12 @@
 }
 
-void psPolynomial1DFree(psPolynomial1D *myPoly)
+static void polynomial1DFree(psPolynomial1D *myPoly)
 {
     psFree(myPoly->coeff);
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-    psFree(myPoly);
-}
-
-void psPolynomial2DFree(psPolynomial2D *myPoly)
+}
+
+static void polynomial2DFree(psPolynomial2D *myPoly)
 {
     int x = 0;
@@ -255,9 +268,7 @@
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-
-    psFree(myPoly);
-}
-
-void psPolynomial3DFree(psPolynomial3D *myPoly)
+}
+
+static void polynomial3DFree(psPolynomial3D *myPoly)
 {
     int x = 0;
@@ -278,8 +289,7 @@
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-    psFree(myPoly);
-}
-
-void psPolynomial4DFree(psPolynomial4D *myPoly)
+}
+
+static void polynomial4DFree(psPolynomial4D *myPoly)
 {
     int w = 0;
@@ -306,5 +316,4 @@
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-    psFree(myPoly);
 }
 
@@ -434,4 +443,5 @@
 
     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
     newPoly->n = n;
     newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
@@ -454,4 +464,5 @@
 
     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
@@ -484,4 +495,5 @@
 
     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
@@ -523,4 +535,5 @@
 
     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
+    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -561,13 +574,12 @@
 }
 
-void psDPolynomial1DFree(psDPolynomial1D *myPoly)
+static void dPolynomial1DFree(psDPolynomial1D *myPoly)
 {
     psFree(myPoly->coeff);
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-    psFree(myPoly);
-}
-
-void psDPolynomial2DFree(psDPolynomial2D *myPoly)
+}
+
+static void dPolynomial2DFree(psDPolynomial2D *myPoly)
 {
     int x = 0;
@@ -581,9 +593,7 @@
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-
-    psFree(myPoly);
-}
-
-void psDPolynomial3DFree(psDPolynomial3D *myPoly)
+}
+
+static void dPolynomial3DFree(psDPolynomial3D *myPoly)
 {
     int x = 0;
@@ -604,8 +614,7 @@
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-    psFree(myPoly);
-}
-
-void psDPolynomial4DFree(psDPolynomial4D *myPoly)
+}
+
+static void dPolynomial4DFree(psDPolynomial4D *myPoly)
 {
     int w = 0;
@@ -632,5 +641,4 @@
     psFree(myPoly->coeffErr);
     psFree(myPoly->mask);
-    psFree(myPoly);
 }
 
Index: trunk/psLib/src/dataManip/psFunctions.h
===================================================================
--- trunk/psLib/src/dataManip/psFunctions.h	(revision 1071)
+++ trunk/psLib/src/dataManip/psFunctions.h	(revision 1073)
@@ -12,6 +12,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-14 19:32:42 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-23 23:00:15 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -104,19 +104,4 @@
                                    );
 
-/** Destructor */
-void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy
-                       );
-
-/** Destructor */
-void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy
-                       );
-/** Destructor */
-void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy
-                       );
-/** Destructor */
-void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy
-                       );
-
-
 /** Evaluate 1D polynomial */
 float
@@ -206,19 +191,4 @@
                                      );
 
-
-/** Destructor */
-void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy
-                        );
-/** Destructor */
-void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy
-                        );
-/** Destructor */
-void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy
-                        );
-/** Destructor */
-void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy
-                        );
-
-
 /** Evaluate 1D polynomial (double precision) */
 double
Index: trunk/psLib/src/dataManip/psStats.c
===================================================================
--- trunk/psLib/src/dataManip/psStats.c	(revision 1071)
+++ trunk/psLib/src/dataManip/psStats.c	(revision 1073)
@@ -32,4 +32,6 @@
                            psStats *stats);
 #endif
+
+static void histogramFree(psHistogram *myHist);
 
 /******************************************************************************
@@ -68,12 +70,4 @@
 
 /******************************************************************************
-    psStatsFree(): This routine must free the psStats data structure.
- *****************************************************************************/
-void psStatsFree(psStats *stats)
-{
-    psFree(stats);
-}
-
-/******************************************************************************
 psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure
 with the specifed upper and lower limits, and the specifed number of bins.
@@ -108,4 +102,5 @@
     // bins, then there are N+1 bounds to those bins.
     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree);
     newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32);
     newHist->bounds->n = newHist->bounds->nalloc;
@@ -160,4 +155,5 @@
     // Allocate memory for the new histogram structure.
     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree);
     newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     newHist->bounds->n = newHist->bounds->nalloc;
@@ -182,9 +178,8 @@
 }
 
-void psHistogramFree(psHistogram *myHist)
-{
-    psVectorFree(myHist->bounds);
-    psVectorFree(myHist->nums);
-    psFree(myHist);
+static void histogramFree(psHistogram *myHist)
+{
+    psFree(myHist->bounds);
+    psFree(myHist->nums);
 }
 
@@ -618,5 +613,5 @@
 
         // Free temporary data buffers.
-        psStatsFree(stats2);
+        psFree(stats2);
 
         // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
@@ -688,6 +683,6 @@
 
     // Free the temporary data structures.
-    psVectorFree(unsortedVector);
-    psVectorFree(sortedVector);
+    psFree(unsortedVector);
+    psFree(sortedVector);
 }
 
@@ -775,5 +770,5 @@
 
         // Free temporary data buffers.
-        psStatsFree(stats2);
+        psFree(stats2);
 
         // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
@@ -840,6 +835,6 @@
 
     // Free the temporary data structures.
-    psVectorFree(unsortedVector);
-    psVectorFree(sortedVector);
+    psFree(unsortedVector);
+    psFree(sortedVector);
     // NOTE: This is the
 }
@@ -1043,5 +1038,5 @@
     }
 
-    psVectorFree(tmpMask);
+    psFree(tmpMask);
 }
 
@@ -1125,6 +1120,6 @@
             stats->robustLQ = stats->clippedMean;
         }
-        psStatsFree(tmpStats);
-        psHistogramFree(robustHistogram);
+        psFree(tmpStats);
+        psFree(robustHistogram);
         return;
     }
@@ -1200,6 +1195,6 @@
     stats->robustNfit = 0.0;
     stats->robustN50 = 0.0;
-    psStatsFree(tmpStats);
-    psHistogramFree(robustHistogram);
+    psFree(tmpStats);
+    psFree(robustHistogram);
 }
 
Index: trunk/psLib/src/dataManip/psStats.h
===================================================================
--- trunk/psLib/src/dataManip/psStats.h	(revision 1071)
+++ trunk/psLib/src/dataManip/psStats.h	(revision 1073)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-14 19:33:09 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-23 23:00:15 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -88,7 +88,4 @@
 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure
 
-/** A destructor for the stats structure.*/
-void psStatsFree(psStats *restrict stats); ///< Stats structure to destroy
-
 /******************************************************************************
     Histogram functions and data structures.
@@ -116,9 +113,4 @@
 psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins
 
-
-/** Destructor \ingroup MathGroup **/
-void psHistogramFree(psHistogram *myHist);          ///< Histogram to destroy
-
-
 /** Calculate a histogram \ingroup MathGroup **/
 psHistogram *psHistogramVector (psHistogram *out,   ///< Histogram data
Index: trunk/psLib/src/dataManip/psVectorFFT.c
===================================================================
--- trunk/psLib/src/dataManip/psVectorFFT.c	(revision 1071)
+++ trunk/psLib/src/dataManip/psVectorFFT.c	(revision 1073)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-12 02:17:25 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-23 23:00:15 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -35,5 +35,5 @@
     /* got good image data? */
     if (in==NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -44,5 +44,5 @@
         psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -51,5 +51,5 @@
         psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
 
@@ -76,5 +76,5 @@
     if (plan == NULL) {
         psError(__func__,"Failed to create FFTW plan.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -98,5 +98,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -143,5 +143,5 @@
         psError(__func__,"Can not extract real component from given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -158,5 +158,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -205,5 +205,5 @@
         psError(__func__,"Can not extract imaginary component from given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -220,5 +220,5 @@
 
     if (real == NULL || imag == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -230,5 +230,5 @@
     if (imag->type.type != type) {
         psError(__func__,"The inputs to psImageComplex must be the same type.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -237,5 +237,5 @@
             imag->numRows != numRows) {
         psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -243,5 +243,5 @@
     if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"The inputs to psImageComplex can not be complex.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -249,5 +249,5 @@
     if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
         psError(__func__,"The input type to psImageComplex must be a floating point.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -287,5 +287,5 @@
         psError(__func__,"Can not merge real and imaginary portions for given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -302,5 +302,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -347,5 +347,5 @@
         psError(__func__,"Can not compute complex conjugate for given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -362,5 +362,5 @@
 
     if (in == NULL) {
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -374,5 +374,5 @@
     if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -417,5 +417,5 @@
         psError(__func__,"Can not power spectrum for given image type (%d).",
                 type);
-        psImageFree(out);
+        psFree(out);
         return NULL;
     }
@@ -435,5 +435,5 @@
     /* got good image data? */
     if (in==NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -444,5 +444,5 @@
         psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -451,5 +451,5 @@
         psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
 
@@ -491,5 +491,5 @@
     if (plan == NULL) {
         psError(__func__,"Failed to create FFTW plan.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -510,5 +510,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -542,5 +542,5 @@
         psError(__func__,"Can not extract real component from given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -556,5 +556,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -588,5 +588,5 @@
         psError(__func__,"Can not extract imaginary component from given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -602,5 +602,5 @@
 
     if (real == NULL || imag == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -615,5 +615,5 @@
     if (imag->type.type != type) {
         psError(__func__,"The inputs to psVectorComplex must be the same type.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -621,5 +621,5 @@
     if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"The inputs to psVectorComplex can not be complex.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -640,5 +640,5 @@
         psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -654,5 +654,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -687,5 +687,5 @@
         psError(__func__,"Can not compute complex conjugate for given vector type (%d).",
                 type);
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -703,5 +703,5 @@
 
     if (in == NULL) {
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -716,5 +716,5 @@
     if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
         psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
-        psVectorFree(out);
+        psFree(out);
         return NULL;
     }
@@ -747,9 +747,9 @@
         psError(__func__,"Can not power spectrum for given vector type (%d).",
                 type);
-        psVectorFree(out);
-        return NULL;
-    }
-
-    return out;
-
-}
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
