Commit 8c0e5435b3

Jakub Konka <kubkon@jakubkonka.com>
2024-02-08 23:50:09
macho: do not close file on error - it will happen automatically anyhow
1 parent 32386a0
Changed files (1)
src
src/link/MachO.zig
@@ -957,7 +957,6 @@ fn parseObject(self: *MachO, path: []const u8) ParseError!void {
 
     const gpa = self.base.comp.gpa;
     const file = try std.fs.cwd().openFile(path, .{});
-    errdefer file.close();
     const handle = try self.addFileHandle(file);
     const mtime: u64 = mtime: {
         const stat = file.stat() catch break :mtime 0;
@@ -994,7 +993,6 @@ fn parseArchive(self: *MachO, lib: SystemLib, must_link: bool, fat_arch: ?fat.Ar
     const gpa = self.base.comp.gpa;
 
     const file = try std.fs.cwd().openFile(lib.path, .{});
-    errdefer file.close();
     const handle = try self.addFileHandle(file);
 
     var archive = Archive{};