summaryrefslogtreecommitdiff
path: root/base/HidlSupport.cpp
diff options
context:
space:
mode:
authorScott Randolph <randolphs@google.com>2017-02-15 16:38:46 -0800
committerScott Randolph <randolphs@google.com>2017-02-15 16:52:05 -0800
commitca37c0effc558ffe93a3c66f0b6b2480ec7410d4 (patch)
tree88c87fbcc0dee6361259dee1b1c6a180cc1ad1be /base/HidlSupport.cpp
parent588205e6f7aa2d0c5d03b3edf168f9e46b073bf3 (diff)
downloadlibhidl-ca37c0effc558ffe93a3c66f0b6b2480ec7410d4.tar.gz
Add missing freeHandle to setTo
On inspection, it looks like without this added call, the possibility exists to leak a handle if a populated handle is "set". Test: local build Change-Id: I9a262fbc1af72ae498dd0e2172216414a263c7fd
Diffstat (limited to 'base/HidlSupport.cpp')
-rw-r--r--base/HidlSupport.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index 912a5b0..7320f3f 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -156,6 +156,7 @@ hidl_handle &hidl_handle::operator=(hidl_handle &&other) {
}
void hidl_handle::setTo(native_handle_t* handle, bool shouldOwn) {
+ freeHandle();
mHandle = handle;
mOwnsHandle = shouldOwn;
}