From adfb1a4bb037b145f725f6422cc8473f4efd1b7c 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 7e9d2070bb9b7c..420c71d7ea4052 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; }