aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_set_format_7zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_write_set_format_7zip.c')
-rw-r--r--libarchive/archive_write_set_format_7zip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libarchive/archive_write_set_format_7zip.c b/libarchive/archive_write_set_format_7zip.c
index f63a2266a85e..92a87f74e625 100644
--- a/libarchive/archive_write_set_format_7zip.c
+++ b/libarchive/archive_write_set_format_7zip.c
@@ -439,7 +439,8 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry)
r = file_new(a, entry, &file);
if (r < ARCHIVE_WARN) {
- file_free(file);
+ if (file != NULL)
+ file_free(file);
return (r);
}
if (file->size == 0 && file->dir) {