Skip to content

Commit c79ccba

Browse files
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
1 parent d781eab commit c79ccba

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tensorflow/core/common_runtime/immutable_executor_state.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Status ImmutableExecutorState::Initialize(const Graph& graph) {
131131

132132
Status s = params_.create_kernel(n->properties(), &item->kernel);
133133
if (!s.ok()) {
134+
params_.delete_kernel(item->kernel);
134135
item->kernel = nullptr;
135136
s = AttachDef(s, *n);
136137
return s;

0 commit comments

Comments
 (0)