We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68b8791 commit abd250bCopy full SHA for abd250b
lib/std/process.zig
@@ -393,8 +393,10 @@ pub const GetEnvVarOwnedError = error{
393
pub fn getEnvVarOwned(allocator: Allocator, key: []const u8) GetEnvVarOwnedError![]u8 {
394
if (builtin.os.tag == .windows) {
395
const result_w = blk: {
396
- const key_w = try std.unicode.wtf8ToWtf16LeAllocZ(allocator, key);
397
- defer allocator.free(key_w);
+ var stack_alloc = std.heap.stackFallback(256 * @sizeOf(u16), allocator);
+ const stack_allocator = stack_alloc.get();
398
+ const key_w = try std.unicode.wtf8ToWtf16LeAllocZ(stack_allocator, key);
399
+ defer stack_allocator.free(key_w);
400
401
break :blk std.os.getenvW(key_w) orelse return error.EnvironmentVariableNotFound;
402
};
0 commit comments