| ... | ... | @@ -498,6 +498,15 @@ pub const Pdb = struct { |
| 498 | 498 | symbols: []u8, |
| 499 | 499 | subsect_info: []u8, |
| 500 | 500 | checksum_offset: ?usize, |
| 501 | |
| 502 | pub fn deinit(self: *Module, allocator: mem.Allocator) void { |
| 503 | allocator.free(self.module_name); |
| 504 | allocator.free(self.obj_file_name); |
| 505 | if (self.populated) { |
| 506 | allocator.free(self.symbols); |
| 507 | allocator.free(self.subsect_info); |
| 508 | } |
| 509 | } |
| 501 | 510 | }; |
| 502 | 511 | |
| 503 | 512 | pub fn init(allocator: mem.Allocator, path: []const u8) !Pdb { |
| ... | ... | @@ -519,6 +528,10 @@ pub const Pdb = struct { |
| 519 | 528 | |
| 520 | 529 | pub fn deinit(self: *Pdb) void { |
| 521 | 530 | self.in_file.close(); |
| 531 | self.msf.deinit(self.allocator); |
| 532 | for (self.modules) |*module| { |
| 533 | module.deinit(self.allocator); |
| 534 | } |
| 522 | 535 | self.allocator.free(self.modules); |
| 523 | 536 | self.allocator.free(self.sect_contribs); |
| 524 | 537 | } |
| ... | ... | @@ -941,6 +954,14 @@ const Msf = struct { |
| 941 | 954 | .streams = streams, |
| 942 | 955 | }; |
| 943 | 956 | } |
| 957 | |
| 958 | fn deinit(self: *Msf, allocator: mem.Allocator) void { |
| 959 | allocator.free(self.directory.blocks); |
| 960 | for (self.streams) |*stream| { |
| 961 | allocator.free(stream.blocks); |
| 962 | } |
| 963 | allocator.free(self.streams); |
| 964 | } |
| 944 | 965 | }; |
| 945 | 966 | |
| 946 | 967 | fn blockCountFromSize(size: u32, block_size: u32) u32 { |