| ... | @@ -690,6 +690,9 @@ pub const ArgIteratorWasi = struct { | ... | @@ -690,6 +690,9 @@ pub const ArgIteratorWasi = struct { |
| 690 | | 690 | |
| 691 | /// Call to free the internal buffer of the iterator. | 691 | /// Call to free the internal buffer of the iterator. |
| 692 | pub fn deinit(self: *ArgIteratorWasi) void { | 692 | pub fn deinit(self: *ArgIteratorWasi) void { |
| | 693 | // Nothing is allocated when there are no args |
| | 694 | if (self.args.len == 0) return; |
| | 695 | |
| 693 | const last_item = self.args[self.args.len - 1]; | 696 | const last_item = self.args[self.args.len - 1]; |
| 694 | const last_byte_addr = @intFromPtr(last_item.ptr) + last_item.len + 1; // null terminated | 697 | const last_byte_addr = @intFromPtr(last_item.ptr) + last_item.len + 1; // null terminated |
| 695 | const first_item_ptr = self.args[0].ptr; | 698 | const first_item_ptr = self.args[0].ptr; |