Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix memory leak when a graph node is invalid.
If a graph node is invalid but a kernel is created then we set the kernel back to `nullptr` but we forget to delete it. Hence, we get a memory leak.

PiperOrigin-RevId: 408968108
Change-Id: I1d8a9d0d8988ed5e08be8b9f2004ce1b4cd11b7c
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Nov 10, 2021
1 parent d781eab commit c79ccba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tensorflow/core/common_runtime/immutable_executor_state.cc
Expand Up @@ -131,6 +131,7 @@ Status ImmutableExecutorState::Initialize(const Graph& graph) {

Status s = params_.create_kernel(n->properties(), &item->kernel);
if (!s.ok()) {
params_.delete_kernel(item->kernel);
item->kernel = nullptr;
s = AttachDef(s, *n);
return s;
Expand Down

0 comments on commit c79ccba

Please sign in to comment.