aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_set_format_zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_write_set_format_zip.c')
-rw-r--r--libarchive/archive_write_set_format_zip.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c
index f69b8467f440..7fcd1a07b3f5 100644
--- a/libarchive/archive_write_set_format_zip.c
+++ b/libarchive/archive_write_set_format_zip.c
@@ -564,10 +564,8 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
zip->entry_uses_zip64 = 0;
zip->entry_crc32 = zip->crc32func(0, NULL, 0);
zip->entry_encryption = 0;
- if (zip->entry != NULL) {
- archive_entry_free(zip->entry);
- zip->entry = NULL;
- }
+ archive_entry_free(zip->entry);
+ zip->entry = NULL;
if (zip->cctx_valid)
archive_encrypto_aes_ctr_release(&zip->cctx);
@@ -1430,6 +1428,9 @@ write_path(struct archive_entry *entry, struct archive_write *archive)
type = archive_entry_filetype(entry);
written_bytes = 0;
+ if (path == NULL)
+ return (ARCHIVE_FATAL);
+
ret = __archive_write_output(archive, path, strlen(path));
if (ret != ARCHIVE_OK)
return (ARCHIVE_FATAL);