aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bun.js/api/bun.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig
index b625f552a..7bd5ebb88 100644
--- a/src/bun.js/api/bun.zig
+++ b/src/bun.js/api/bun.zig
@@ -3411,7 +3411,10 @@ pub const EnvironmentVariables = struct {
const name = str.slice();
if (jsc_vm.bundler.env.map.map.fetchSwapRemove(name)) |entry| {
- allocator.free(bun.constStrToU8(entry.value));
+ // this can be a statically allocated string
+ if (bun.isHeapMemory(entry.value))
+ allocator.free(bun.constStrToU8(entry.value));
+
allocator.free(bun.constStrToU8(entry.key));
return true;
}