aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/node
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-09-07 21:07:00 -0800
committerGravatar GitHub <noreply@github.com> 2023-09-07 21:07:00 -0800
commit822a00c4d508b54f650933a73ca5f4a3af9a7983 (patch)
tree8c0d1e7ce7e9c230f97bcc17c3169647267b1eec /src/bun.js/node
parentf6a621f36a87d54d14e2b2ea81c1bcef4906ae63 (diff)
downloadbun-v1.0.0.tar.gz
bun-v1.0.0.tar.zst
bun-v1.0.0.zip
Fix a couple important bugs (#4560)bun-v1.0.0
Diffstat (limited to 'src/bun.js/node')
-rw-r--r--src/bun.js/node/node_fs.zig11
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",