summaryrefslogtreecommitdiff
path: root/archival/libunarchive/get_header_cpio.c
diff options
context:
space:
mode:
authorGlenn L McGrath2004-04-29 09:24:19 +0000
committerGlenn L McGrath2004-04-29 09:24:19 +0000
commitfaa3546fd74bcb6cf193bebe8662a718e13d8fdf (patch)
treebd91fdd6432939f0b39bfb585b3c07b7e49357c1 /archival/libunarchive/get_header_cpio.c
parentf71ad6c9e487dc853ba6f7e1c238efdd4ed140a8 (diff)
downloadbusybox-faa3546fd74bcb6cf193bebe8662a718e13d8fdf.zip
busybox-faa3546fd74bcb6cf193bebe8662a718e13d8fdf.tar.gz
Fix symlink handling and small memory leak
Diffstat (limited to 'archival/libunarchive/get_header_cpio.c')
-rw-r--r--archival/libunarchive/get_header_cpio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index e8a68f1..f72c376 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -117,6 +117,8 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
file_header->link_name[file_header->size] = '\0';
archive_handle->offset += file_header->size;
file_header->size = 0; /* Stop possible seeks in future */
+ } else {
+ file_header->link_name = NULL;
}
if (nlink > 1 && !S_ISDIR(file_header->mode)) {
if (file_header->size == 0) { /* Put file on a linked list for later */
@@ -151,5 +153,8 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
}
archive_handle->offset += file_header->size;
+
+ free(file_header->link_name);
+
return (EXIT_SUCCESS);
}