Prevent double-closing of native handle in HidlMemory

Since the handle wasn't nullified, when the memory is explicitly
closed, the finalizer would attempt to close again, which results in
an exception.

Bug: 189213084
Test: Manual verification of ST use-cases, which uses this.
      Patch sent to partner for verification.
Change-Id: I4ac6bbdd88b3f729a022896adfed00effec48bd8
This commit is contained in:
Ytai Ben-Tsvi
2021-05-25 08:20:59 -07:00
parent cad4e327bf
commit 808e525d57

View File

@@ -79,6 +79,7 @@ public class HidlMemory implements Closeable {
public void close() throws IOException {
if (mHandle != null) {
mHandle.close();
mHandle = null;
}
}