lite: nnapi: Fix fd leak in NNMemory's destructor

Valid fd values are non-negative, including zero.

Signed-off-by: Waqar Hameed <whame91@gmail.com>
This commit is contained in:
Waqar Hameed 2021-02-25 20:02:22 +01:00
parent 076b5be77d
commit 46ff46bd09

View File

@ -676,7 +676,7 @@ NNMemory::~NNMemory() {
if (nn_memory_handle_) {
nnapi_->ANeuralNetworksMemory_free(nn_memory_handle_);
}
if (fd_ > 0) close(fd_);
if (fd_ >= 0) close(fd_);
#endif
}