Skip to content

Commit

Permalink
Close FILE before throwing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kbinani committed Sep 3, 2024
1 parent fac78df commit 3e8c558
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/ZIPFoundation/Archive+BackingConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extension Archive {
throw POSIXError(errno, path: url.path)
}
guard let (eocdRecord, zip64EOCD) = Archive.scanForEndOfCentralDirectoryRecord(in: archiveFile) else {
fclose(archiveFile)
throw ArchiveError.missingEndOfCentralDirectoryRecord
}
return BackingConfiguration(file: archiveFile,
Expand All @@ -71,6 +72,7 @@ extension Archive {
throw POSIXError(errno, path: url.path)
}
guard let (eocdRecord, zip64EOCD) = Archive.scanForEndOfCentralDirectoryRecord(in: archiveFile) else {
fclose(archiveFile)
throw ArchiveError.missingEndOfCentralDirectoryRecord
}
fseeko(archiveFile, 0, SEEK_SET)
Expand Down

0 comments on commit 3e8c558

Please sign in to comment.