mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
pdb: fix resource mgmt
This commit is contained in:
parent
bedd7efa2b
commit
74bfb8ba07
@ -498,6 +498,15 @@ pub const Pdb = struct {
|
||||
symbols: []u8,
|
||||
subsect_info: []u8,
|
||||
checksum_offset: ?usize,
|
||||
|
||||
pub fn deinit(self: *Module, allocator: mem.Allocator) void {
|
||||
allocator.free(self.module_name);
|
||||
allocator.free(self.obj_file_name);
|
||||
if (self.populated) {
|
||||
allocator.free(self.symbols);
|
||||
allocator.free(self.subsect_info);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
pub fn init(allocator: mem.Allocator, path: []const u8) !Pdb {
|
||||
@ -519,6 +528,10 @@ pub const Pdb = struct {
|
||||
|
||||
pub fn deinit(self: *Pdb) void {
|
||||
self.in_file.close();
|
||||
self.msf.deinit(self.allocator);
|
||||
for (self.modules) |*module| {
|
||||
module.deinit(self.allocator);
|
||||
}
|
||||
self.allocator.free(self.modules);
|
||||
self.allocator.free(self.sect_contribs);
|
||||
}
|
||||
@ -941,6 +954,14 @@ const Msf = struct {
|
||||
.streams = streams,
|
||||
};
|
||||
}
|
||||
|
||||
fn deinit(self: *Msf, allocator: mem.Allocator) void {
|
||||
allocator.free(self.directory.blocks);
|
||||
for (self.streams) |*stream| {
|
||||
allocator.free(stream.blocks);
|
||||
}
|
||||
allocator.free(self.streams);
|
||||
}
|
||||
};
|
||||
|
||||
fn blockCountFromSize(size: u32, block_size: u32) u32 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user