From: Martin Matuška Date: Sun, 22 Sep 2024 23:04:09 +0000 (+0200) Subject: tar: fix memory leaks when processing symlinks or parsing pax headers (#2341) X-Git-Tag: v3.7.6~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de883f881cdb85cd91c20e29e8a0f4dd05caf485;p=thirdparty%2Flibarchive.git tar: fix memory leaks when processing symlinks or parsing pax headers (#2341) Fix memory leaks introduced by #2127: * `struct tar` member `entry_linkpath` was moved at the same time as other members were removed, but its cleanup was accidentally removed with the others. * `header_pax_extension` local variable `attr_name` was not cleaned up. Resolves #2336 (cherry picked from commit 7c3980367e79c3f89e9ba595bbe67b3983b26215) Co-authored-by: Brad King --- diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index af601efba..cb103c368 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -296,6 +296,7 @@ archive_read_format_tar_cleanup(struct archive_read *a) archive_string_free(&tar->entry_pathname_override); archive_string_free(&tar->entry_uname); archive_string_free(&tar->entry_gname); + archive_string_free(&tar->entry_linkpath); archive_string_free(&tar->line); archive_string_free(&tar->pax_global); archive_string_free(&tar->longname); @@ -1935,6 +1936,7 @@ header_pax_extension(struct archive_read *a, struct tar *tar, *unconsumed += 1; tar_flush_unconsumed(a, unconsumed); } + archive_string_free(&attr_name); *unconsumed += ext_size + ext_padding; /*