Index: trunk/stac/src/stacRead.c
===================================================================
--- trunk/stac/src/stacRead.c	(revision 6771)
+++ trunk/stac/src/stacRead.c	(revision 6887)
@@ -13,7 +13,9 @@
     int nFiles = filenames->n;          // The number of input files
     psArray *images = psArrayAlloc(nFiles); // The input files, to be returned
+    images->n = nFiles;
     assert(!headers || ! *headers || (*headers)->n == nFiles);
     if (headers && ! *headers) {
         *headers = psArrayAlloc(nFiles);
+        (*headers)->n = nFiles;
     }
 
@@ -71,16 +73,14 @@
     psArray *coords = psArrayAlloc(BUFFER); // The array of coordinates to be returned
     float x, y;                         // Coordinates to read
-    int num = 0;                        // Number of coordinates read
     while (fscanf(file, "%f %f\n", &x, &y) == 2) {
         psPlane *coord = psPlaneAlloc();// A coordinate
         coord->x = x;
         coord->y = y;
-        coords->data[num] = coord;
-        num++;
-        if (num % BUFFER) {
-            coords = psArrayRealloc(coords, num + BUFFER);
-        }
-    }
-    coords->n = num;
+        coords->data[coords->n] = coord;
+        coords->n++;
+        if (coords->n % BUFFER == 0) {
+            coords = psArrayRealloc(coords, coords->n + BUFFER);
+        }
+    }
 
     psTrace("stac.read.coords", 5, "%d coordinates read.\n", num);
@@ -184,4 +184,5 @@
     int nFiles = filenames->n;          // The number of input files
     psArray *maps = psArrayAlloc(nFiles); // The maps, to be returned
+    maps->n = nFiles;
     char mapfile[MAXCHAR];              // Filename of map
 
