Prevent double file close in MachO linking

This commit is contained in:
Alex Cameron 2020-11-08 17:51:19 +11:00 committed by Andrew Kelley
parent 0c520cd32d
commit a2582df5b2

View File

@ -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;