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)) {
