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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
addaleax authored and Myles Borins committed Apr 20, 2016
1 parent 96be986 commit adfb1a4
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 adfb1a4

Please sign in to comment.