From: Tim Kientzle Date: Wed, 7 Jan 2009 04:55:58 +0000 (-0500) Subject: Fix a memory leak: ISO9660 handler leaked a file entry X-Git-Tag: v2.7.0~461 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff5ac6b3cb58520a72cfa13f643f17035a1730c2;p=thirdparty%2Flibarchive.git Fix a memory leak: ISO9660 handler leaked a file entry structure whenever the file entry had a garbage CE offset. SVN-Revision: 389 --- diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index 4a1484b23..13077344a 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -414,8 +414,10 @@ archive_read_format_iso9660_read_header(struct archive_read *a, /* Get the next entry that appears after the current offset. */ r = next_entry_seek(a, iso9660, &file); - if (r != ARCHIVE_OK) + if (r != ARCHIVE_OK) { + release_file(iso9660, file); return (r); + } iso9660->entry_bytes_remaining = file->size; iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */ @@ -1090,6 +1092,9 @@ release_file(struct iso9660 *iso9660, struct file_info *file) { struct file_info *parent; + if (file == NULL) + return; + if (file->refcount == 0) { parent = file->parent; archive_string_free(&file->name);