Skip to content

Commit

Permalink
child_process: add nullptr checks after allocs
Browse files Browse the repository at this point in the history
Add `CHECK_NE(·, nullptr)` after allocations made when
spawning child processes.

PR-URL: nodejs#6256
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
addaleax authored and joelostrowski committed Apr 25, 2016
1 parent 0887421 commit 3ee7444
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/process_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 3ee7444

Please sign in to comment.