Index: trunk/psLib/src/sys/psMemory.c
===================================================================
--- trunk/psLib/src/sys/psMemory.c	(revision 7617)
+++ trunk/psLib/src/sys/psMemory.c	(revision 7901)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-06-21 21:40:12 $
+*  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-07-14 02:26:25 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -24,25 +24,13 @@
 #include "psAbort.h"
 #include "psLogMsg.h"
-
 #include "psBitSet.h"
-//#include "psArray.h"
-//#include "psImage.h"
-//#include "psList.h"
-//#include "psLookupTable.h"
-//#include "psHash.h"
-
-//#include "psMetadata.h"
 #include "psFits.h"
 #include "psPixels.h"
-//#include "psScalar.h"
-//#include "psVector.h"
-//#include "psTime.h"
-//#include "psCoord.h"
 #include "psSphereOps.h"
-//#include "psStats.h"
 #include "psMinimizeLMM.h"
 #include "psImageConvolve.h"
 #include "psTime.h"
-
+#include "psLine.h"
+#include "psRegion.h"
 #include "psErrorText.h"
 
@@ -837,7 +825,24 @@
 }
 
+bool is_psType(psPtr ptr)
+{
+    if (ptr == NULL) {
+        return false;
+    }
+    psMemBlock* m = ((psMemBlock* ) ptr) - 1;
+    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
+        return false; //Probably not a psAllocated-Type
+    } else {
+        return true;
+    }
+}
+
 bool psMemCheckType(psDataType type,
                     psPtr ptr)
 {
+    if (!is_psType(ptr)) {
+        return false;
+    }
+
     switch(type) {
     case PS_DATA_ARRAY:
@@ -905,4 +910,12 @@
             break;
         }
+    case PS_DATA_LINE:
+        if ( psMemCheckLine(ptr) )
+            return true;
+        else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Incorrect pointer.  Datatypes do not match.\n");
+            break;
+        }
     case PS_DATA_LIST:
         if ( psMemCheckList(ptr) )
@@ -1017,4 +1030,12 @@
             break;
         }
+    case PS_DATA_REGION:
+        if ( psMemCheckRegion(ptr) )
+            return true;
+        else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Incorrect pointer.  Datatypes do not match.\n");
+            break;
+        }
     case PS_DATA_SCALAR:
         if ( psMemCheckScalar(ptr) )
@@ -1051,4 +1072,12 @@
     case PS_DATA_STATS:
         if ( psMemCheckStats(ptr) )
+            return true;
+        else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Incorrect pointer.  Datatypes do not match.\n");
+            break;
+        }
+    case PS_DATA_STRING:
+        if ( psMemCheckString(ptr) )
             return true;
         else {
