Index: trunk/Nebulous/nebclient/src/nebclient.c
===================================================================
--- trunk/Nebulous/nebclient/src/nebclient.c	(revision 24997)
+++ trunk/Nebulous/nebclient/src/nebclient.c	(revision 24999)
@@ -812,7 +812,7 @@
     }
 
-    nullstrncpy(stat->so_id, resultArray[0], 256);
-    nullstrncpy(stat->ext_id, resultArray[1], 256);
-    nullstrncpy(stat->read_lock, resultArray[2], 256);
+    stat->so_id     = atol(resultArray[0]);
+    stat->ext_id    = atol(resultArray[1]);
+    stat->read_lock = atoi(resultArray[2]);
     nullstrncpy(stat->write_lock, resultArray[3], 256);
     nullstrncpy(stat->epoch, resultArray[4], 256);
@@ -831,11 +831,5 @@
     }
 
-    xfree(stat->so_id);
-    xfree(stat->ext_id);
-    xfree(stat->read_lock);
-    xfree(stat->write_lock);
-    xfree(stat->epoch);
-    xfree(stat->mtime);
-    xfree(stat);
+    nebFree(stat);
 }
 
@@ -935,14 +929,16 @@
             return -1;
         }
+
+        int available = stat->available;
+        nebObjectStatFree(stat);
+
         // start at one so cull() is called one less time then the # of
         // instances
-        for (long i = 1; i < stat->available; i++) {
+        for (long i = 1; i < available; i++) {
             if (!nebCull(server, key)) {
-                nebObjectStatFree(stat);
                 return -1;
             }
             removed++;
         }
-        nebObjectStatFree(stat);
     }
 
@@ -958,4 +954,5 @@
 
 void nebFree(void *ptr) {
+    if (!ptr) { return; }
     xfree(ptr);
 }
@@ -1197,4 +1194,8 @@
     }
 
+    if (!dest) {
+        dest = xmalloc(n + 1);
+    }
+
     return strncpy(dest, src, n);
 }
