]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
tar: Release memory on error path
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 20 Apr 2026 17:06:11 +0000 (19:06 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 20 Apr 2026 18:12:13 +0000 (20:12 +0200)
Release attr_name memory on error paths.

Fixes: 101646e34e88 ("tar: Keep block alignment after pax error")
Fixes: 36a530973a91 ("Fix an infinite loop when parsing `V` headers")
libarchive/archive_read_support_format_tar.c

index 2979492767edf190ba6180353cb96b76b0b048f6..98800ec31aa49397e4f4df5e06a3dd74586d609e 100644 (file)
@@ -2009,6 +2009,7 @@ header_pax_extension(struct archive_read *a, struct tar *tar,
                /* Consume size, name, and `=` */
                *unconsumed += p - attr_start;
                if (tar_flush_unconsumed(a, unconsumed) != ARCHIVE_OK) {
+                       archive_string_free(&attr_name);
                        return (ARCHIVE_FATAL);
                }
 
@@ -2016,6 +2017,7 @@ header_pax_extension(struct archive_read *a, struct tar *tar,
                        archive_set_error(&a->archive, EINVAL,
                                          "Malformed pax attributes");
                        *unconsumed += ext_size + ext_padding;
+                       archive_string_free(&attr_name);
                        return (ARCHIVE_WARN);
                }