diff options
author | WON JUN LEE <wonjun44.lee@samsung.com> | 2020-09-25 01:59:09 +0900 |
---|---|---|
committer | WON JUN LEE <wonjun44.lee@samsung.com> | 2020-10-06 02:22:49 +0000 |
commit | b3270e4ecea5df12fb4c57bb56f8dfb19bbf1f1f (patch) | |
tree | 65e1047cc32c12544bf7121de4d9da5555921fe2 /nn | |
parent | 3ab5ca5044de7f1f5929cd90147503025f2982e1 (diff) | |
download | ml-b3270e4ecea5df12fb4c57bb56f8dfb19bbf1f1f.tar.gz |
Add to close copied dupfd.
dupfd will be left when nativeHandle is null.
Because if nativeHandle is null, error will be returned
without close the dupfd.
Test: mma
Signed-off-by: WON JUN LEE <wonjun44.lee@samsung.com>
Change-Id: Ib7701a26ee548078e927797f1a13ca21f1b99904
Diffstat (limited to 'nn')
-rw-r--r-- | nn/runtime/Memory.cpp | 1 |
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}; |