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: #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 MylesBorins committed Apr 21, 2016
1 parent df93d6b commit 2e6e2d6
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 @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 2e6e2d6

Please sign in to comment.