From 4be0c01cc5a0bd1ed5ef002501c3ffd3746f200f Mon Sep 17 00:00:00 2001 From: Luis Oliveira Rios Date: Mon, 15 Jan 2024 09:50:10 -0800 Subject: [PATCH] BackendMemory::Create must release all errors --- src/backend_memory.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend_memory.cc b/src/backend_memory.cc index 25be571..9b0c69c 100644 --- a/src/backend_memory.cc +++ b/src/backend_memory.cc @@ -143,6 +143,12 @@ BackendMemory::Create( return TRITONSERVER_ErrorNew(TRITONSERVER_ERROR_UNAVAILABLE, msg.c_str()); } + // If it succeeded we might have to clean up errors associated with + // attempts that failed + for (const auto& pr : errors) { + TRITONSERVER_ErrorDelete(pr.second); + } + return nullptr; // success }