authorgravatar for zihadmahiuddin@gmail.comZihad <zihadmahiuddin@gmail.com> 2025-12-03 00:09:00+06:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-12-03 08:35:24+01:00
logcb115cf73a986ab3f246628a332d06c0deb8feda
tree4f701b7ff26b37a616b48094325d10134095b1fc
parentbe9649f4ea5a32fdb5b5ce6488a6ae7d30f3acb0

std.process.ArgIteratorWasi: fix no-args deinit


1 files changed, 3 insertions(+), 0 deletions(-)

lib/std/process.zig+3
...@@ -690,6 +690,9 @@ pub const ArgIteratorWasi = struct {...@@ -690,6 +690,9 @@ pub const ArgIteratorWasi = struct {
690690
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 terminated697 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;