Browse Source

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>
v4.x
Anna Henningsen 9 years ago
committed by Myles Borins
parent
commit
6ad85914b1
  1. 2
      src/process_wrap.cc

2
src/process_wrap.cc

@ -165,6 +165,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;
}
@ -186,6 +187,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…
Cancel
Save