Index: /trunk/psLib/test/sysUtils/tst_psHash03.c
===================================================================
--- /trunk/psLib/test/sysUtils/tst_psHash03.c	(revision 872)
+++ /trunk/psLib/test/sysUtils/tst_psHash03.c	(revision 873)
@@ -9,6 +9,8 @@
 #include "psTest.h"
 #include "psHash.h"
+#include "psMemory.h"
 #define NUM_HASH_TABLE_BUCKETS 100
 int imGlobal = 0;
+int currentId = 0;
 
 typedef struct
@@ -17,7 +19,34 @@
 }
 ID;
+
+// NOTE: This is my own little routine I used in debugging a memory
+// leak.  I will take this out of this file later.
+void printMemBlocks(char *myString)
+{
+    psMemBlock **memBlocks = NULL;
+    psMemBlock *tmp = NULL;
+    int numBlocks = 0;
+
+    numBlocks = psMemCheckLeaks(currentId, &memBlocks, NULL);
+    printf("******************** %s ********************\n", myString);
+    printf("%d mem blocks\n", psMemCheckLeaks(currentId,NULL,NULL));
+    printf("%d blocks\n", numBlocks);
+    printf("*  ");
+    if (memBlocks != NULL) {
+        for (tmp = *memBlocks; tmp != NULL; tmp = tmp->nextBlock) {
+            printf("%d ", (int) tmp->id);
+        }
+    }
+    printf("*\n");
+    printf("*************************************************\n");
+    psFree(memBlocks);
+}
+
 static ID *IdAlloc(const char *name)
 {
-    ID *id = psAlloc(sizeof(ID));
+    ID *id = NULL;
+
+    id = psAlloc(sizeof(ID));
+
     id->name = psStringCopy(name);
 
@@ -40,6 +69,7 @@
     char *myKeys[] = {"ENTRY00", "ENTRY01", "ENTRY02", "ENTRY03", NULL};
     char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL};
-    int currentId = psMemGetId();
     int memLeaks        = 0;
+
+    currentId = psMemGetId();
 
     printPositiveTestHeader(stdout,
@@ -48,4 +78,5 @@
 
     myHashTable = psHashAlloc(NUM_HASH_TABLE_BUCKETS);
+
     i = 0;
     while (myKeys[i] != NULL) {
@@ -54,5 +85,4 @@
         i++;
     }
-
 
     i = 0;
@@ -66,8 +96,8 @@
     }
 
-
     i = 0;
     while (myKeys[i] != NULL) {
-        id = psHashRemove(myHashTable, myKeys[i]);
+        id = psHashRemove(myHashTable, myKeys[i], (void (*)(void *))IdFree);
+        IdFree(id);
         id = psHashLookup(myHashTable, myKeys[i]);
         if (id != NULL) {
@@ -78,5 +108,4 @@
     }
 
-
     printFooter(stdout,
                 "psHash functions",
@@ -84,6 +113,4 @@
                 testStatus);
 
-    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
-    printf("HMMM: %d memory leaks.  Callin psHashFree()\n", memLeaks);
     psHashFree(myHashTable, (void (*)(void *))IdFree);
     memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
