components/libarchive/patches/archive_write_set_format_pax.c.patch
author John Beck <John.Beck@Oracle.COM>
Mon, 17 Jun 2013 14:23:50 -0700
branchs11-update
changeset 2651 9b563675339e
permissions -rw-r--r--
PSARC 2012/356 libarchive 15959922 add libarchive to Userland

A less complete version of this patch was fed back to the upstream community:
http://code.google.com/p/libarchive/issues/detail?id=285
This more complete patch was committed instead.  It should no longer be
needed with the next release.

--- libarchive/libarchive/archive_write_set_format_pax.c.orig	Mon Mar 26 19:49:00 2012
+++ libarchive/libarchive/archive_write_set_format_pax.c	Sun Dec  2 04:03:38 2012
@@ -647,8 +647,10 @@ archive_write_pax_header(struct archive_write *a,
		oname = archive_entry_pathname(entry_original);
		name_length = strlen(oname);
		name = malloc(name_length + 3);
-		if (name == NULL) {
+		if (name == NULL || extra == NULL) {
			/* XXX error message */
+			archive_entry_free(extra);
+			free(name);
			return (ARCHIVE_FAILED);
		}
		strcpy(name, oname);
@@ -687,6 +689,7 @@ archive_write_pax_header(struct archive_write *a,

		/* Recurse to write the special copyfile entry. */
		r = archive_write_pax_header(a, extra);
+		archive_entry_free(extra);
		if (r < ARCHIVE_WARN)
			return (r);
		if (r < ret)