Merge "Move castInterface into details." am: 989d44b606 am: 5b2b156585
am: 735b0069cc

Change-Id: Id2a64b10ed8df5503957a0b05a9ca0983e16fae2
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index 547f7e7..bacb3d4 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -151,6 +151,7 @@
 }
 
 void hidl_handle::setTo(native_handle_t* handle, bool shouldOwn) {
+    freeHandle();
     mHandle = handle;
     mOwnsHandle = shouldOwn;
 }