]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
xar: free write file on utility-name failure
authordatauwu <datauwu@users.noreply.github.com>
Wed, 15 Jul 2026 14:34:01 +0000 (22:34 +0800)
committerdatauwu <datauwu@users.noreply.github.com>
Wed, 15 Jul 2026 14:34:01 +0000 (22:34 +0800)
Free the pending write file when utility name generation fails early.

libarchive/archive_write_set_format_xar.c

index 4478ceb588e2091c3816d2d025e186d6b0302921..59d94bf337f42b1eaf5caa087b56afd4e7457e45 100644 (file)
@@ -582,8 +582,10 @@ xar_write_header(struct archive_write *a, struct archive_entry *entry)
                return (ARCHIVE_FATAL);
        }
        r2 = file_gen_utility_names(a, file);
-       if (r2 < ARCHIVE_WARN)
+       if (r2 < ARCHIVE_WARN) {
+               file_free(file);
                return (r2);
+       }
 
        /*
         * Ignore a path which looks like the top of directory name