| ... | @@ -142,10 +142,11 @@ pub const Coff = struct { | ... | @@ -142,10 +142,11 @@ pub const Coff = struct { |
| 142 | } | 142 | } |
| 143 | | 143 | |
| 144 | pub fn loadSections(self: *Coff) !void { | 144 | pub fn loadSections(self: *Coff) !void { |
| 145 | if (self.sections.len != 0) | 145 | if (self.sections.len == self.coff_header.number_of_sections) |
| 146 | return; | 146 | return; |
| 147 | | 147 | |
| 148 | self.sections = ArrayList(Section).init(self.allocator); | 148 | self.sections = ArrayList(Section).init(self.allocator); |
| | 149 | try self.sections.ensureCapacity(self.coff_header.number_of_sections); |
| 149 | | 150 | |
| 150 | var file_stream = self.in_file.inStream(); | 151 | var file_stream = self.in_file.inStream(); |
| 151 | const in = &file_stream.stream; | 152 | const in = &file_stream.stream; |