summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-10-14 05:29:06 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-10-14 05:29:06 +0000
commita6374e359b6c89776539ba3f6959438f2267ec49 (patch)
treebf7773a6a5f9c128cbdc5ccdcac13795953bbd70
parent951b52c5eb1cd0a427bdb77b92ff85f33b516d50 (diff)
parent249e93788723f1132e11e9621412e2910114f46b (diff)
downloadml-a6374e359b6c89776539ba3f6959438f2267ec49.tar.gz
Merge "Add to close copied dupfd." am: 249e937887
Original change: https://android-review.googlesource.com/c/platform/frameworks/ml/+/1436811 Change-Id: I345cadbba83bccc16b2b1e407bba987cb6db09c9
-rw-r--r--nn/runtime/Memory.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/nn/runtime/Memory.cpp b/nn/runtime/Memory.cpp
index fb97af55b..ee9faf934 100644
--- a/nn/runtime/Memory.cpp
+++ b/nn/runtime/Memory.cpp
@@ -558,6 +558,7 @@ std::pair<int, std::unique_ptr<MemoryFd>> MemoryFd::create(size_t size, int prot
native_handle_t* nativeHandle = native_handle_create(1, 3);
if (nativeHandle == nullptr) {
LOG(ERROR) << "Failed to create native_handle";
+ close(dupfd);
// TODO(b/120417090): is ANEURALNETWORKS_UNEXPECTED_NULL the correct
// error to return here?
return {ANEURALNETWORKS_UNEXPECTED_NULL, nullptr};