Merge pull request #3029 from stoeckmann/iso_memleak

iso9660: Fix memory leaks on error paths
(cherry picked from commit d0ee2d32ef)
This commit is contained in:
Tim Kientzle authored and Martin Matuska committed 2026-06-23 10:28:22 +02:00
1 parent b126a0d2a6
commit 38b2346e91
1 file changed
+7 -1
@@ -1170,6 +1170,7 @@ archive_write_set_format_iso9660(struct archive *_a)
iso9660->cur_dirent = iso9660->primary.rootent;
archive_string_init(&(iso9660->cur_dirstr));
if (archive_string_ensure(&(iso9660->cur_dirstr), 1) == NULL) {
free(iso9660->cur_dirent);
free(iso9660);
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory");
@@ -6764,7 +6765,12 @@ isoent_rr_move_dir(struct archive_write *a, struct isoent **rr_moved,
/*
* The mvent becomes a child of the rr_moved entry.
*/
isoent_add_child_tail(rrmoved, mvent);
if (!isoent_add_child_tail(rrmoved, mvent)) {
_isoent_free(mvent);
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Unable to insert rr_moved entry");
return (ARCHIVE_FATAL);
}
archive_entry_set_nlink(rrmoved->file->entry,
archive_entry_nlink(rrmoved->file->entry) + 1);
/*