From cb115cf73a986ab3f246628a332d06c0deb8feda Mon Sep 17 00:00:00 2001 From: Zihad Date: Wed, 3 Dec 2025 00:09:00 +0600 Subject: [PATCH] std.process.ArgIteratorWasi: fix no-args deinit --- lib/std/process.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/process.zig b/lib/std/process.zig index a638eb6496..d0424d09d1 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -690,6 +690,9 @@ pub const ArgIteratorWasi = struct { /// Call to free the internal buffer of the iterator. pub fn deinit(self: *ArgIteratorWasi) void { + // Nothing is allocated when there are no args + if (self.args.len == 0) return; + const last_item = self.args[self.args.len - 1]; const last_byte_addr = @intFromPtr(last_item.ptr) + last_item.len + 1; // null terminated const first_item_ptr = self.args[0].ptr;