Commit 5b42704ea7

Alex Cameron <ascottcameron@gmail.com>
2020-11-08 07:51:19
Prevent double file close in MachO linking
1 parent c8b6e40
Changed files (1)
src
src/link/MachO.zig
@@ -256,7 +256,10 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
     errdefer file.close();
 
     const self = try createEmpty(allocator, options);
-    errdefer self.base.destroy();
+    errdefer {
+        self.base.file = null;
+        self.base.destroy();
+    }
 
     self.base.file = file;