summaryrefslogtreecommitdiffhomepage
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-26 18:22:41 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-26 18:22:41 +0200
commitb768aeb164d361d1ca2c8f6c091e93442f072656 (patch)
tree7cd91b9057fcfcea857ea8f96de1d1adac970bab /archival/libunarchive
parent52827e3ebcd80f634f990030ee697254a0ae517d (diff)
tar: make typical extraction less memory-hungry
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/get_header_tar.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 01c10433e..21bbc9715 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -436,9 +436,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
/* (like GNU tar 1.15.1: verbose mode outputs "dir/dir/") */
if (cp)
*cp = '\0';
- //archive_handle->ah_flags |= ARCHIVE_EXTRACT_QUIET; // why??
archive_handle->action_data(archive_handle);
- llist_add_to(&(archive_handle->passed), file_header->name);
+ if (archive_handle->accept || archive_handle->reject)
+ llist_add_to(&archive_handle->passed, file_header->name);
+ else /* Caller isn't interested in list of unpacked files */
+ free(file_header->name);
} else {
data_skip(archive_handle);
free(file_header->name);
@@ -446,7 +448,8 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
archive_handle->offset += file_header->size;
free(file_header->link_target);
- /* Do not free(file_header->name)! (why?) */
+ /* Do not free(file_header->name)!
+ * It might be inserted in archive_handle->passed - see above */
#if ENABLE_FEATURE_TAR_UNAME_GNAME
free(file_header->tar__uname);
free(file_header->tar__gname);