]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Properly free and close when exiting write_hierarchy() on failed
authorMartin Matuska <martin@matuska.org>
Tue, 4 Oct 2016 10:09:28 +0000 (12:09 +0200)
committerMartin Matuska <martin@matuska.org>
Tue, 4 Oct 2016 10:13:46 +0000 (12:13 +0200)
archive_read_next_header2().

Fixes #794

tar/write.c

index 2d076f488b5591b742ecfef16780b43204af4a10..da5a128254faa40010617f580e00645211eb98cc 100644 (file)
@@ -886,6 +886,8 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
                            "%s", archive_error_string(disk));
                        if (r == ARCHIVE_FATAL || r == ARCHIVE_FAILED) {
                                bsdtar->return_value = 1;
+                               archive_entry_free(entry);
+                               archive_read_close(disk);
                                return;
                        } else if (r < ARCHIVE_WARN)
                                continue;