child_process: add nullptr checks after allocs
Add `CHECK_NE(·, nullptr)` after allocations made when spawning child processes. PR-URL: https://github.com/nodejs/node/pull/6256 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
aa4d2ae897
commit
29ca969651
@ -166,6 +166,7 @@ class ProcessWrap : public HandleWrap {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
node::Utf8Value arg(env->isolate(), js_argv->Get(i));
|
||||
options.args[i] = strdup(*arg);
|
||||
CHECK_NE(options.args[i], nullptr);
|
||||
}
|
||||
options.args[argc] = nullptr;
|
||||
}
|
||||
@ -187,6 +188,7 @@ class ProcessWrap : public HandleWrap {
|
||||
for (int i = 0; i < envc; i++) {
|
||||
node::Utf8Value pair(env->isolate(), env_opt->Get(i));
|
||||
options.env[i] = strdup(*pair);
|
||||
CHECK_NE(options.env[i], nullptr);
|
||||
}
|
||||
options.env[envc] = nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user