--- a/toybox-4428d64c0c40/toys/posix/cpio.c	2014-09-04 10:53:51.000000000 +0530
+++ b/Toybox/toys/posix/cpio.c	2014-09-05 10:23:10.380538114 +0530
@@ -94,7 +94,10 @@
     // Read header and name.
     xreadall(afd, toybuf, 110);
     tofree = name = strpad(afd, x8u(toybuf+94), 110);
-    if (!strcmp("TRAILER!!!", name)) break;
+    if (!strcmp("TRAILER!!!", name)) {
+      free(tofree);
+      break;
+    }
 
     // If you want to extract absolute paths, "cd /" and run cpio.
     while (*name == '/') name++;
@@ -123,6 +126,7 @@
       if (!test) err = symlink(data, name);
       // Can't get a filehandle to a symlink, so do special chown
       if (!err && !getpid()) err = lchown(name, uid, gid);
+      free(data);
     } else if (S_ISREG(mode)) {
       int fd = test ? 0 : open(name, O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW, mode);
 
@@ -249,4 +253,5 @@
     xwrite(afd, toybuf,
       sprintf(toybuf, "070701%040X%056X%08XTRAILER!!!", 1, 0x0b, 0)+4);
   }
+  if (TT.archive) xclose(afd);
 }
