diff options
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(); } |