Fix symlink handling and small memory leak
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 @@
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 @@
}
archive_handle->offset += file_header->size;
+
+ free(file_header->link_name);
+
return (EXIT_SUCCESS);
}