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.
  • Loading branch information
addaleax committed Apr 18, 2016
1 parent 15f13cd commit 1cf6bf7
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 1cf6bf7

Please sign in to comment.