diff options
author | 2022-11-18 03:47:10 -0800 | |
---|---|---|
committer | 2022-11-18 03:47:10 -0800 | |
commit | f3fb71205110448a4fb69ee39d11dc092a97069c (patch) | |
tree | d73b9eebb4278af711004d4bc8f6af58347ec019 /src/bun.js/api/bun.zig | |
parent | f6779193c0e1c57b6d78979b7aacecda4e29081b (diff) | |
download | bun-f3fb71205110448a4fb69ee39d11dc092a97069c.tar.gz bun-f3fb71205110448a4fb69ee39d11dc092a97069c.tar.zst bun-f3fb71205110448a4fb69ee39d11dc092a97069c.zip |
Fix crash in process.env.FOO = bar that happened sometimes
Diffstat (limited to 'src/bun.js/api/bun.zig')
-rw-r--r-- | src/bun.js/api/bun.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index b6abde2b0..49143ec5c 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -3408,7 +3408,9 @@ pub const EnvironmentVariables = struct { entry.value_ptr.* = value_str.slice(); } else { - allocator.free(bun.constStrToU8(entry.value_ptr.*)); + // this can be a statically allocated string + if (bun.isHeapMemory(entry.value_ptr.*)) + allocator.free(bun.constStrToU8(entry.value_ptr.*)); const cloned_value = value.?.value().toSlice(globalThis, allocator).cloneIfNeeded(allocator) catch return false; entry.value_ptr.* = cloned_value.slice(); } |