Skip to content

Commit 2b07c23

Browse files
committed
src: initialize variables in paths that use them
1 parent c8df98d commit 2b07c23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node_file.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2482,11 +2482,10 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
24822482
}
24832483
} else { // write(fd, string, pos, enc, undefined, ctx)
24842484
CHECK_EQ(argc, 6);
2485-
FSReqWrapSync req_wrap_sync;
2486-
FSReqBase::FSReqBuffer stack_buffer;
24872485
if (buf == nullptr) {
24882486
if (!StringBytes::StorageSize(isolate, value, enc).To(&len))
24892487
return;
2488+
FSReqBase::FSReqBuffer stack_buffer;
24902489
stack_buffer.AllocateSufficientStorage(len + 1);
24912490
// StorageSize may return too large a char, so correct the actual length
24922491
// by the write size
@@ -2496,6 +2495,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
24962495
buf = *stack_buffer;
24972496
}
24982497
uv_buf_t uvbuf = uv_buf_init(buf, len);
2498+
FSReqWrapSync req_wrap_sync("write");
24992499
FS_SYNC_TRACE_BEGIN(write);
25002500
int bytesWritten = SyncCall(env, args[5], &req_wrap_sync, "write",
25012501
uv_fs_write, fd, &uvbuf, 1, pos);

0 commit comments

Comments
 (0)