From 1b09ea922468b9e7b6c9f6afef141d07be584bbd Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Wed, 13 Oct 2021 11:28:26 -0700 Subject: [PATCH] Handle error returned by IBurstContext::freeMemory Unhandled HIDL errors result in a crash. This CL handles any errors from IBurstContext::freeMemory by logging the error and continuing with the rest of the function. Bug: N/A Test: mma Change-Id: Ic433a627137df4d275a1b0d2d800d592afc1a18c --- neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp b/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp index b4b6f680d3..8ce96c41b9 100644 --- a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp +++ b/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp @@ -176,7 +176,10 @@ void ExecutionBurstController::MemoryCache::freeMemory(const nn::SharedMemory& m std::lock_guard guard(mMutex); const int32_t slot = mMemoryIdToSlot.at(memory); if (mBurstContext) { - mBurstContext->freeMemory(slot); + const auto ret = mBurstContext->freeMemory(slot); + if (!ret.isOk()) { + LOG(ERROR) << "IBustContext::freeMemory failed: " << ret.description(); + } } mMemoryIdToSlot.erase(memory); mMemoryCache[slot] = {};