From 2dd4f7e96b5fa08802c3112f70d45821ac155b2d Mon Sep 17 00:00:00 2001 From: edgchen1 <18449977+edgchen1@users.noreply.github.com> Date: Wed, 22 Apr 2020 20:18:29 -0700 Subject: [PATCH] Add check for nullptr in PlannerImpl::FindReusableTensor(). (#3619) --- onnxruntime/core/framework/allocation_planner.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index 373a888c58..3e4fc15348 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -330,6 +330,11 @@ class PlannerImpl { for (auto it = freelist_.begin(); it != freelist_.end(); ++it) { size_t reusable = static_cast(it->ml_value); const onnxruntime::NodeArg* p_node_arg = ort_value_info_.at(reusable).p_def_site; + if (!p_node_arg) { + // TODO this should be an error case, needs more investigation + // https://msdata.visualstudio.com/Vienna/_workitems/edit/724826/ + continue; + } auto& available_memory_info = AllocPlan(p_node_arg->Name()).location; if (!(available_memory_info == required_memory_info)) continue; auto p_available_buffer_shape = context_.GetShape(*p_node_arg);