macho: revert changes to file descriptors mgmt

This commit is contained in:
Jakub Konka 2022-10-19 22:16:27 +02:00
parent 15f1e6a60c
commit bc1e714de6
2 changed files with 3 additions and 6 deletions

View File

@ -3,7 +3,7 @@ const Archive = @This();
const std = @import("std");
const assert = std.debug.assert;
const fs = std.fs;
const log = std.log.scoped(.macho);
const log = std.log.scoped(.link);
const macho = std.macho;
const mem = std.mem;
@ -88,6 +88,7 @@ const ar_hdr = extern struct {
};
pub fn deinit(self: *Archive, allocator: Allocator) void {
self.file.close();
for (self.toc.keys()) |*key| {
allocator.free(key.*);
}
@ -217,7 +218,7 @@ pub fn parseObject(
const contents = try gpa.allocWithOptions(u8, object_size, @alignOf(u64), null);
const amt = try reader.readAll(contents);
if (amt != object_size) {
return error.Io;
return error.InputOutput;
}
var object = Object{

View File

@ -1420,10 +1420,6 @@ pub const Zld = struct {
pub fn deinit(self: *Zld) void {
const gpa = self.gpa;
for (self.archives.items) |archive| {
archive.file.close();
}
self.tlv_ptr_entries.deinit(gpa);
self.tlv_ptr_table.deinit(gpa);
self.got_entries.deinit(gpa);