diff --git a/source/coral/list.zig b/source/coral/list.zig index b21e081..77cbb67 100755 --- a/source/coral/list.zig +++ b/source/coral/list.zig @@ -52,7 +52,7 @@ pub fn Stack(comptime Value: type) type { return; } - io.deallocate(allocator, self.values); + io.deallocate(allocator, self.values.ptr[0 .. self.capacity]); self.values = &.{}; self.capacity = 0; @@ -132,7 +132,7 @@ pub fn Stack(comptime Value: type) type { pub fn push_all(self: *Self, allocator: io.Allocator, values: []const Value) io.AllocationError!void { const new_length = self.values.len + values.len; - if (new_length >= self.capacity) { + if (new_length > self.capacity) { try self.grow(allocator, values.len + values.len); }