| ... | ... | @@ -293,6 +293,10 @@ pub fn getEnvMap(allocator: Allocator) !EnvMap { |
| 293 | 293 | return os.unexpectedErrno(environ_sizes_get_ret); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | if (environ_count == 0) { |
| 297 | return result; |
| 298 | } |
| 299 | |
| 296 | 300 | var environ = try allocator.alloc([*:0]u8, environ_count); |
| 297 | 301 | defer allocator.free(environ); |
| 298 | 302 | var environ_buf = try allocator.alloc(u8, environ_buf_size); |
| ... | ... | @@ -468,6 +472,10 @@ pub const ArgIteratorWasi = struct { |
| 468 | 472 | else => |err| return os.unexpectedErrno(err), |
| 469 | 473 | } |
| 470 | 474 | |
| 475 | if (count == 0) { |
| 476 | return &[_][:0]u8{}; |
| 477 | } |
| 478 | |
| 471 | 479 | var argv = try allocator.alloc([*:0]u8, count); |
| 472 | 480 | defer allocator.free(argv); |
| 473 | 481 | |