zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit cb115cf73a986ab3f246628a332d06c0deb8feda (tree)
parent be9649f4ea5a32fdb5b5ce6488a6ae7d30f3acb0
Author: Zihad <zihadmahiuddin@gmail.com>
Date:   Wed,  3 Dec 2025 00:09:00 +0600

std.process.ArgIteratorWasi: fix no-args deinit

Diffstat:
Mlib/std/process.zig | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git 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;