Index: /branches/rel10_ifa/psLib/src/types/psArray.c
===================================================================
--- /branches/rel10_ifa/psLib/src/types/psArray.c	(revision 6550)
+++ /branches/rel10_ifa/psLib/src/types/psArray.c	(revision 6551)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-11-16 23:06:35 $
+ *  @version $Revision: 1.40.10.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-03-09 02:42:56 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -68,4 +68,6 @@
     // Create vector data array
     psArr->data = psAlloc(nalloc * sizeof(psPtr));
+    // Set everything to NULL
+    memset(psArr->data, (int)NULL, nalloc*sizeof(psPtr));
 
     return psArr;
@@ -78,5 +80,6 @@
         psError(PS_ERR_BAD_PARAMETER_NULL,true,PS_ERRORTEXT_psArray_REALLOC_NULL);
         return NULL;
-    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
+    }
+    if (in->nalloc != nalloc) {         // No need to realloc to same size
         if (nalloc < in->n) {
             for (psS32 i = nalloc; i < in->n; i++) {      // For reduction in vector size
@@ -87,4 +90,8 @@
         // Realloc after decrementation to avoid accessing freed array elements
         in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
+        if (nalloc > in->nalloc) {
+            // Expanding the array: set new pointers to NULL
+            memset(&in->data[in->nalloc], (int)NULL, nalloc - in->nalloc);
+        }
         P_PSARRAY_SET_NALLOC(in,nalloc);
     }
