diff --git a/src/bun.js/api/ExtractJob.zig b/src/bun.js/api/ExtractJob.zig index 6d5e830e36..27f645d8fb 100644 --- a/src/bun.js/api/ExtractJob.zig +++ b/src/bun.js/api/ExtractJob.zig @@ -238,6 +238,7 @@ pub const ExtractJob = struct { } const key = try allocator.dupe(u8, normalized); + errdefer allocator.free(key); try this.files.put(key, buf); } } diff --git a/src/bun.js/api/TarballJob.zig b/src/bun.js/api/TarballJob.zig index 59ed50b10d..e81ba2a4bf 100644 --- a/src/bun.js/api/TarballJob.zig +++ b/src/bun.js/api/TarballJob.zig @@ -133,7 +133,10 @@ pub const TarballJob = struct { } if (this.destination) |destination| { - const file = std.fs.cwd().openFile(destination, .{}) catch return error.CannotOpenFile; + const file = (if (std.fs.path.isAbsolute(destination)) + std.fs.openFileAbsolute(destination, .{}) + else + std.fs.cwd().openFile(destination, .{})) catch return error.CannotOpenFile; defer file.close(); this.bytes_written = (file.stat() catch return error.CannotStatFile).size; } else {