From 6ad85914b113fbf99a9c36211445363a1f66a5e9 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 18 Apr 2016 07:37:40 +0200 Subject: [PATCH] child_process: add nullptr checks after allocs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add `CHECK_NE(ยท, nullptr)` after allocations made when spawning child processes. PR-URL: https://github.com/nodejs/node/pull/6256 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/process_wrap.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/process_wrap.cc b/src/process_wrap.cc index adf1606591..3456d2be8f 100644 --- a/src/process_wrap.cc +++ b/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; }