Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-12-05 18:12:22 +0300
committerRich Trott <rtrott@gmail.com>2019-12-07 21:06:29 +0300
commit0fe54f282648996d5672436955b23c0fd8952633 (patch)
treeae46c5a56b1844522430ea620b6483a97e933f17 /src
parent147317f60c41acdd934c6da3868f442e05226e37 (diff)
src: use checked allocations in WASI::New()
PR-URL: https://github.com/nodejs/node/pull/30809 Refs: https://github.com/nodejs/node/issues/30257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_wasi.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node_wasi.cc b/src/node_wasi.cc
index 8de7f1fc1ca..b3b266f5cfe 100644
--- a/src/node_wasi.cc
+++ b/src/node_wasi.cc
@@ -134,7 +134,7 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
Local<Array> preopens = args[2].As<Array>();
CHECK_EQ(preopens->Length() % 2, 0);
options.preopenc = preopens->Length() / 2;
- options.preopens = UncheckedCalloc<uvwasi_preopen_t>(options.preopenc);
+ options.preopens = Calloc<uvwasi_preopen_t>(options.preopenc);
int index = 0;
for (uint32_t i = 0; i < preopens->Length(); i += 2) {
auto mapped = preopens->Get(context, i).ToLocalChecked();
@@ -144,7 +144,9 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
node::Utf8Value mapped_path(env->isolate(), mapped);
node::Utf8Value real_path(env->isolate(), real);
options.preopens[index].mapped_path = strdup(*mapped_path);
+ CHECK_NOT_NULL(options.preopens[index].mapped_path);
options.preopens[index].real_path = strdup(*real_path);
+ CHECK_NOT_NULL(options.preopens[index].real_path);
index++;
}