diff options
Diffstat (limited to 'src/bun.js/node/node_fs.zig')
-rw-r--r-- | src/bun.js/node/node_fs.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig index 33b3589b3..d9e3ed119 100644 --- a/src/bun.js/node/node_fs.zig +++ b/src/bun.js/node/node_fs.zig @@ -3045,7 +3045,7 @@ pub const Arguments = struct { } pub fn fromJS(ctx: JSC.C.JSContextRef, arguments: *ArgumentsSlice, exception: JSC.C.ExceptionRef) ?CopyFile { - const src = PathLike.fromJS(ctx, arguments, exception) orelse { + const src = PathLike.fromJSWithAllocator(ctx, arguments, bun.default_allocator, exception) orelse { if (exception.* == null) { JSC.throwInvalidArguments( "src must be a string or buffer", @@ -3059,7 +3059,9 @@ pub const Arguments = struct { if (exception.* != null) return null; - const dest = PathLike.fromJS(ctx, arguments, exception) orelse { + const dest = PathLike.fromJSWithAllocator(ctx, arguments, bun.default_allocator, exception) orelse { + src.deinit(); + if (exception.* == null) { JSC.throwInvalidArguments( "dest must be a string or buffer", @@ -3107,7 +3109,7 @@ pub const Arguments = struct { } pub fn fromJS(ctx: JSC.C.JSContextRef, arguments: *ArgumentsSlice, exception: JSC.C.ExceptionRef) ?Cp { - const src = PathLike.fromJS(ctx, arguments, exception) orelse { + const src = PathLike.fromJSWithAllocator(ctx, arguments, bun.default_allocator, exception) orelse { if (exception.* == null) { JSC.throwInvalidArguments( "src must be a string or buffer", @@ -3121,7 +3123,8 @@ pub const Arguments = struct { if (exception.* != null) return null; - const dest = PathLike.fromJS(ctx, arguments, exception) orelse { + const dest = PathLike.fromJSWithAllocator(ctx, arguments, bun.default_allocator, exception) orelse { + defer src.deinit(); if (exception.* == null) { JSC.throwInvalidArguments( "dest must be a string or buffer", |