Index: /trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.c	(revision 4307)
+++ /trunk/psLib/src/astronomy/psAstrometry.c	(revision 4308)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-08 00:26:01 $
+ *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -55,5 +55,5 @@
         psFree(fpa->chips);
         psFree(fpa->grommit);
-        psFree((psExposure*)fpa->exposure);
+        psFree(fpa->exposure);
         psFree(fpa->metadata);
         psFree(fpa->fromTangentPlane);
@@ -102,5 +102,5 @@
 {
     if (obs != NULL) {
-        psFree((psPtr)obs->name);
+        psFree(obs->name);
     }
 }
@@ -109,8 +109,8 @@
 {
     if (exp != NULL) {
-        psFree((psPtr)exp->time);
-        psFree((psPtr)exp->observatory);
-        psFree((psPtr)exp->cameraName);
-        psFree((psPtr)exp->telescopeName);
+        psFree(exp->time);
+        psFree(exp->observatory);
+        psFree(exp->cameraName);
+        psFree(exp->telescopeName);
     }
 }
Index: /trunk/psLib/src/collections/psMetadata.c
===================================================================
--- /trunk/psLib/src/collections/psMetadata.c	(revision 4307)
+++ /trunk/psLib/src/collections/psMetadata.c	(revision 4308)
@@ -12,6 +12,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-03 02:07:51 $
+*  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-17 23:44:21 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -89,8 +89,8 @@
 
     psHashAdd(table, key, item); // put in the new entry
+    psMemDecrRefCounter(item); // get rid of extra reference
 
     // free local references of newly allocated items.
     psFree(newList);
-    psFree(item);
 
     return item;
@@ -107,6 +107,6 @@
     }
 
-    psFree(metadataItem->name);
-    psFree(metadataItem->comment);
+    psMemDecrRefCounter(metadataItem->name);
+    psMemDecrRefCounter(metadataItem->comment);
 
     if(!PS_META_IS_PRIMITIVE(type)) {
Index: /trunk/psLib/src/dataIO/psFits.c
===================================================================
--- /trunk/psLib/src/dataIO/psFits.c	(revision 4307)
+++ /trunk/psLib/src/dataIO/psFits.c	(revision 4308)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-09 21:17:45 $
+ *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -203,5 +203,5 @@
     if (fits != NULL) {
         (void)fits_close_file(fits->p_fd, &status);
-        psFree((void*)fits->filename);
+        psFree(fits->filename);
     }
 }
Index: /trunk/psLib/src/dataIO/psFits.h
===================================================================
--- /trunk/psLib/src/dataIO/psFits.h	(revision 4307)
+++ /trunk/psLib/src/dataIO/psFits.h	(revision 4308)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-11 02:19:05 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -33,9 +33,9 @@
  */
 typedef enum {
-    PS_FITS_TYPE_NONE = -1,    ///< Unknown HDU type
-    PS_FITS_TYPE_IMAGE = IMAGE_HDU,   ///< Image HDU type
-    PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL,   ///< Binary table HDU type
-    PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,  ///< ASCII table HDU type
-    PS_FITS_TYPE_ANY = ANY_HDU    ///< Any HDU type
+    PS_FITS_TYPE_NONE = -1,            ///< Unknown HDU type
+    PS_FITS_TYPE_IMAGE = IMAGE_HDU,    ///< Image HDU type
+    PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL, ///< Binary table HDU type
+    PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,   ///< ASCII table HDU type
+    PS_FITS_TYPE_ANY = ANY_HDU         ///< Any HDU type
 } psFitsType;
 
Index: /trunk/psLib/src/dataIO/psLookupTable.c
===================================================================
--- /trunk/psLib/src/dataIO/psLookupTable.c	(revision 4307)
+++ /trunk/psLib/src/dataIO/psLookupTable.c	(revision 4308)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-09 00:56:37 $
+*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-17 23:44:21 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -246,6 +246,6 @@
 
     psFree(table->values);
-    psFree((char*)table->filename);
-    psFree((char*)table->format);
+    psFree(table->filename);
+    psFree(table->format);
 }
 
Index: /trunk/psLib/src/fits/psFits.c
===================================================================
--- /trunk/psLib/src/fits/psFits.c	(revision 4307)
+++ /trunk/psLib/src/fits/psFits.c	(revision 4308)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-09 21:17:45 $
+ *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -203,5 +203,5 @@
     if (fits != NULL) {
         (void)fits_close_file(fits->p_fd, &status);
-        psFree((void*)fits->filename);
+        psFree(fits->filename);
     }
 }
Index: /trunk/psLib/src/fits/psFits.h
===================================================================
--- /trunk/psLib/src/fits/psFits.h	(revision 4307)
+++ /trunk/psLib/src/fits/psFits.h	(revision 4308)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-11 02:19:05 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -33,9 +33,9 @@
  */
 typedef enum {
-    PS_FITS_TYPE_NONE = -1,    ///< Unknown HDU type
-    PS_FITS_TYPE_IMAGE = IMAGE_HDU,   ///< Image HDU type
-    PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL,   ///< Binary table HDU type
-    PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,  ///< ASCII table HDU type
-    PS_FITS_TYPE_ANY = ANY_HDU    ///< Any HDU type
+    PS_FITS_TYPE_NONE = -1,            ///< Unknown HDU type
+    PS_FITS_TYPE_IMAGE = IMAGE_HDU,    ///< Image HDU type
+    PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL, ///< Binary table HDU type
+    PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,   ///< ASCII table HDU type
+    PS_FITS_TYPE_ANY = ANY_HDU         ///< Any HDU type
 } psFitsType;
 
Index: /trunk/psLib/src/image/psImageGeomManip.c
===================================================================
--- /trunk/psLib/src/image/psImageGeomManip.c	(revision 4307)
+++ /trunk/psLib/src/image/psImageGeomManip.c	(revision 4308)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-16 22:07:41 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -865,4 +865,6 @@
     }
 
+    psFree(inPosition);
+
     return output;
 }
Index: /trunk/psLib/src/imageops/psImageGeomManip.c
===================================================================
--- /trunk/psLib/src/imageops/psImageGeomManip.c	(revision 4307)
+++ /trunk/psLib/src/imageops/psImageGeomManip.c	(revision 4308)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-16 22:07:41 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -865,4 +865,6 @@
     }
 
+    psFree(inPosition);
+
     return output;
 }
Index: /trunk/psLib/src/sys/psErrorCodes.c
===================================================================
--- /trunk/psLib/src/sys/psErrorCodes.c	(revision 4307)
+++ /trunk/psLib/src/sys/psErrorCodes.c	(revision 4308)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-04-07 20:27:41 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -29,5 +29,5 @@
  *     $2  The error description (rest of the line in psErrorCodes.dat)
  *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
- * 
+ *
  * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
  */
@@ -90,5 +90,5 @@
 static void freeErrorDescription(psErrorDescription* err)
 {
-    psFree((psPtr)err->description);
+    psFree(err->description);
 }
 
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 4307)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 4308)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-17 21:42:02 $
+ *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -239,5 +239,5 @@
 /// Free memory.  psFree sends file and line number to p_psFree.
 #ifndef SWIG
-#define psFree(ptr) p_psFree(ptr, __FILE__, __LINE__)
+#define psFree(ptr) { p_psFree((psPtr)ptr, __FILE__, __LINE__);  *(void**)&ptr = NULL; }
 #endif // ! SWIG
 
Index: /trunk/psLib/src/sys/psTrace.c
===================================================================
--- /trunk/psLib/src/sys/psTrace.c	(revision 4307)
+++ /trunk/psLib/src/sys/psTrace.c	(revision 4308)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-08 23:40:45 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -97,5 +97,5 @@
 
     p_psMemSetPersistent((psPtr)comp->name,false);
-    psFree((psPtr)comp->name);
+    psFree(comp->name);
 }
 
Index: /trunk/psLib/src/sysUtils/psErrorCodes.c
===================================================================
--- /trunk/psLib/src/sysUtils/psErrorCodes.c	(revision 4307)
+++ /trunk/psLib/src/sysUtils/psErrorCodes.c	(revision 4308)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-04-07 20:27:41 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -29,5 +29,5 @@
  *     $2  The error description (rest of the line in psErrorCodes.dat)
  *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
- * 
+ *
  * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
  */
@@ -90,5 +90,5 @@
 static void freeErrorDescription(psErrorDescription* err)
 {
-    psFree((psPtr)err->description);
+    psFree(err->description);
 }
 
Index: /trunk/psLib/src/sysUtils/psMemory.h
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.h	(revision 4307)
+++ /trunk/psLib/src/sysUtils/psMemory.h	(revision 4308)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-17 21:42:02 $
+ *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -239,5 +239,5 @@
 /// Free memory.  psFree sends file and line number to p_psFree.
 #ifndef SWIG
-#define psFree(ptr) p_psFree(ptr, __FILE__, __LINE__)
+#define psFree(ptr) { p_psFree((psPtr)ptr, __FILE__, __LINE__);  *(void**)&ptr = NULL; }
 #endif // ! SWIG
 
Index: /trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.c	(revision 4307)
+++ /trunk/psLib/src/sysUtils/psTrace.c	(revision 4308)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-08 23:40:45 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -97,5 +97,5 @@
 
     p_psMemSetPersistent((psPtr)comp->name,false);
-    psFree((psPtr)comp->name);
+    psFree(comp->name);
 }
 
Index: /trunk/psLib/src/types/psLookupTable.c
===================================================================
--- /trunk/psLib/src/types/psLookupTable.c	(revision 4307)
+++ /trunk/psLib/src/types/psLookupTable.c	(revision 4308)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-09 00:56:37 $
+*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-17 23:44:21 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -246,6 +246,6 @@
 
     psFree(table->values);
-    psFree((char*)table->filename);
-    psFree((char*)table->format);
+    psFree(table->filename);
+    psFree(table->format);
 }
 
Index: /trunk/psLib/src/types/psMetadata.c
===================================================================
--- /trunk/psLib/src/types/psMetadata.c	(revision 4307)
+++ /trunk/psLib/src/types/psMetadata.c	(revision 4308)
@@ -12,6 +12,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-03 02:07:51 $
+*  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-17 23:44:21 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -89,8 +89,8 @@
 
     psHashAdd(table, key, item); // put in the new entry
+    psMemDecrRefCounter(item); // get rid of extra reference
 
     // free local references of newly allocated items.
     psFree(newList);
-    psFree(item);
 
     return item;
@@ -107,6 +107,6 @@
     }
 
-    psFree(metadataItem->name);
-    psFree(metadataItem->comment);
+    psMemDecrRefCounter(metadataItem->name);
+    psMemDecrRefCounter(metadataItem->comment);
 
     if(!PS_META_IS_PRIMITIVE(type)) {
Index: /trunk/psLib/test/collections/tst_psArray.c
===================================================================
--- /trunk/psLib/test/collections/tst_psArray.c	(revision 4307)
+++ /trunk/psLib/test/collections/tst_psArray.c	(revision 4308)
@@ -17,6 +17,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-04-07 20:27:41 $
+ *  @version $Revision: 1.14 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2005-06-17 23:44:22 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -202,5 +202,5 @@
         }
     }
-    psFree(mySt[0]);
+    psMemDecrRefCounter(mySt[0]);
     printFooter(stderr,"psArray","Remove valid item", true);
 
@@ -235,13 +235,5 @@
         psFree(mySt[i]);
     }
-    if( psMemCheckLeaks(0, NULL, stderr, false) != 0) {
-        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
-        return 110;
-    }
-    psS32 nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        fprintf(stderr,"ERROR: Found %d bad memory blocks\n", nBad);
-        return 111;
-    }
+
     printFooter(stderr, "psArray" ,"Free void pointer array", true);
 
@@ -361,6 +353,4 @@
         }
 
-        psFree(data);
-
         subtest++;
         if (arr->nalloc != nalloc) {
@@ -386,4 +376,6 @@
             return subtest;
         }
+
+        psFree(data);
     }
 
@@ -391,5 +383,4 @@
     data = psAlloc(sizeof(float));
     arr = psArrayAdd(arr, delta, data);
-    psFree(data);
 
     // make sure the array was expanded
@@ -418,4 +409,6 @@
     }
 
+    psFree(data);
+
     // make the array full again (operation tested already)
     while (arr->n < arr->nalloc) {
Index: /trunk/psLib/test/collections/tst_psMetadata_04.c
===================================================================
--- /trunk/psLib/test/collections/tst_psMetadata_04.c	(revision 4307)
+++ /trunk/psLib/test/collections/tst_psMetadata_04.c	(revision 4308)
@@ -23,6 +23,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.18 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2005-04-07 20:27:41 $
+*  @version $Revision: 1.19 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2005-06-17 23:44:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -101,5 +101,5 @@
     psMetadataAddItem(metadata, item5, PS_LIST_HEAD, PS_META_DEFAULT);
     psMetadataAddItem(metadata, item6, PS_LIST_HEAD, PS_META_DEFAULT);
-    psFree(vec);
+    psMemDecrRefCounter(vec); // vs. psFree, which now would set vec to NULL (want to keep it to comparison later)
     printFooter(stdout, "psMetadata", "Test A - Allocate metadata items", true);
 
Index: /trunk/psLib/test/dataManip/tst_psVectorFFT.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psVectorFFT.c	(revision 4307)
+++ /trunk/psLib/test/dataManip/tst_psVectorFFT.c	(revision 4308)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-05-11 22:02:16 $
+*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-17 23:44:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -474,5 +474,4 @@
 
     psFree( vec );
-    psFree( vec2 );
 
     // Perform conjugate for non-complex number
@@ -509,5 +508,5 @@
     for ( psU32 n = 0; n < 100; n++ ) {
         if ( fabsf( crealf(vec->data.C64[n]) - crealf(vec2->data.C64[n])) > FLT_EPSILON ||
-                fabsf( cimagf(vec->data.C64[n]) - cimagf(vec2->data.C64[n])) > FLT_EPSILON ) {
+                fabsf( cimagf(vec->data.C64[n]) + cimagf(vec2->data.C64[n])) > FLT_EPSILON ) {
             psError(PS_ERR_UNKNOWN,true,"psVectorConjugate result is invalid (n=%d)",n);
             return 13;
@@ -516,6 +515,6 @@
     psFree(vec);
 
-    // Perform vector conjugate with null input
-    if ( psVectorConjugate(NULL,NULL) != NULL) {
+    // Perform vector conjugate with null input (vec2 should be freed too)
+    if ( psVectorConjugate(vec2,NULL) != NULL) {
         psError(PS_ERR_UNKNOWN,true,"Did not return NULL with null input vector");
         return 61;
Index: /trunk/psLib/test/image/tst_psImageGeomManip.c
===================================================================
--- /trunk/psLib/test/image/tst_psImageGeomManip.c	(revision 4307)
+++ /trunk/psLib/test/image/tst_psImageGeomManip.c	(revision 4308)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-11 02:19:05 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 23:44:22 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1077,6 +1077,68 @@
 static psS32 testImageTransform(void)
 {
-
-    /// XXX: TODO
+    int cols = 16;
+    int rows = 32;
+
+    psPlaneTransform* trans = psPlaneTransformAlloc(2,2);
+    trans->x->coeff[1][0] = 0.5;
+    trans->y->coeff[0][1] = 1.5;
+
+    psImage* in = psImageAlloc(cols,rows,PS_TYPE_F32);
+    for (psS32 row=0;row<rows;row++) {
+        psF32* inRow = in->data.F32[row];
+        for (psS32 col=0;col<cols;col++) {
+            inRow[col] = (psF32)row+(psF32)col/1000.0f;
+        }
+    }
+
+    psImage* out = psImageTransform(NULL,
+                                    NULL,
+                                    in,
+                                    NULL,
+                                    0,
+                                    trans,
+                                    psRegionSet(0,cols*2,0,rows*2),
+                                    NULL,
+                                    PS_INTERPOLATE_FLAT,
+                                    -1);
+
+    if (out == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "out == NULL");
+        return 1;
+    }
+    if (out->type.type != PS_TYPE_F32) {
+        psError(PS_ERR_UNKNOWN, false,
+                "out->type.type != PS_TYPE_F32, out->type.type == %d",
+                out->type.type);
+        return 2;
+    }
+    if (out->numRows != rows*2 || out->numCols != cols*2) {
+        psError(PS_ERR_UNKNOWN, false,
+                "out size is %dx%d, not %dx%d",
+                out->numCols, out->numRows, cols*2, rows);
+        return 3;
+    }
+
+    for (psS32 row=0;row<out->numRows;row++) {
+        psF32* outRow = out->data.F32[row];
+        for (psS32 col=0;col<cols;col++) {
+            float inValue = p_psImagePixelInterpolateFLAT_F32(in,
+                            col*trans->x->coeff[1][0]+trans->x->coeff[0][0],
+                            row*trans->y->coeff[0][1]+trans->y->coeff[0][0],
+                            NULL, 0,
+                            -1);
+            if (fabsf(outRow[col] - inValue) > FLT_EPSILON*10) {
+                psError(PS_ERR_UNKNOWN, false,
+                        "out at %d,%d was %g, expected %g",
+                        col,row,outRow[col], inValue);
+                return 4;
+            }
+        }
+    }
+
+    psFree(out);
+    psFree(in);
+    psFree(trans);
     return 0;
 }
Index: /trunk/psLib/test/image/verified/tst_psImagePixelManip.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImagePixelManip.stderr	(revision 4307)
+++ /trunk/psLib/test/image/verified/tst_psImagePixelManip.stderr	(revision 4308)
@@ -27,6 +27,4 @@
 <DATE><TIME>|<HOST>|I|testImageClip
     Following should be an error (max<min)
-<DATE><TIME>|<HOST>|E|psImageClip (FILE:LINENO)
-    Specified min value, 256, can not be greater than the specified max value, 128.
 
 ---> TESTPOINT PASSED (psImage{psImageClip} | tst_psImagePixelManip.c)
Index: /trunk/psLib/test/sysUtils/tst_psMemory.c
===================================================================
--- /trunk/psLib/test/sysUtils/tst_psMemory.c	(revision 4307)
+++ /trunk/psLib/test/sysUtils/tst_psMemory.c	(revision 4308)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-04-07 20:27:42 $
+*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-17 23:44:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -130,5 +130,5 @@
     psLogMsg( __func__, PS_LOG_INFO, "psFree shall be just decrement a multiple refererenced pointer." );
 
-    psFree( mem );
+    psMemDecrRefCounter( mem );
 
     ref = psMemGetRefCounter( mem );
@@ -521,10 +521,11 @@
 {
 
-    psPtr  buffer = psAlloc( 1024 );
+    psPtr buffer = psAlloc( 1024 );
+    psPtr buffer2 = buffer;
 
     psFree( buffer );
 
     psLogMsg( __func__, PS_LOG_INFO, "Next should abort due to multiple freeing." );
-    psFree( buffer );
+    psFree( buffer2 );
 
     psError(PS_ERR_UNKNOWN,true,
