diff --git a/std/coff.zig b/std/coff.zig index 97d286f0e6..ceb6050055 100644 --- a/std/coff.zig +++ b/std/coff.zig @@ -142,10 +142,11 @@ pub const Coff = struct { } pub fn loadSections(self: *Coff) !void { - if (self.sections.len != 0) + if (self.sections.len == self.coff_header.number_of_sections) return; self.sections = ArrayList(Section).init(self.allocator); + try self.sections.ensureCapacity(self.coff_header.number_of_sections); var file_stream = self.in_file.inStream(); const in = &file_stream.stream;