]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
7z: Free the file if compression-level option is invalid (#2608)
authorAZero13 <gfunni234@gmail.com>
Fri, 16 May 2025 21:41:18 +0000 (17:41 -0400)
committerGitHub <noreply@github.com>
Fri, 16 May 2025 21:41:18 +0000 (23:41 +0200)
Otherwise, the file is leaked.

libarchive/archive_write_set_format_7zip.c

index e7644c03d5da5dd0be231f98f10eb1fc4b3391ef..902d03f6a8faa1c8932e0240641ee2177a9506fd 100644 (file)
@@ -615,6 +615,7 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry)
                } else if (level < 0 || level > 9) {
                        archive_set_error(&(a->archive), ARCHIVE_ERRNO_MISC,
                                "compression-level option value `%d' out of range 0-9", level);
+                       file_free(file);
                        return (ARCHIVE_FATAL);
                }
 #endif