summaryrefslogtreecommitdiff
path: root/base/HidlSupport.cpp
diff options
context:
space:
mode:
authorHridya Valsaraju <hridya@google.com>2017-02-27 08:48:38 -0800
committerHridya Valsaraju <hridya@google.com>2017-03-01 03:34:43 +0000
commit0126889103d84c2078896688017d61d612a12c4f (patch)
treee942ef049920c1b386439fca7a9f85ee643b145e /base/HidlSupport.cpp
parent64a41d5877f245b8f1ad4a6957a139a9c1588c21 (diff)
downloadlibhidl-0126889103d84c2078896688017d61d612a12c4f.tar.gz
Add move constructor/assignment operator to hidl_memory
Bug: 34093434 Test: hidl_test passes Change-Id: I6bb7e2e3c914040daa8d72d9a86a5a3d3f8338e5
Diffstat (limited to 'base/HidlSupport.cpp')
-rw-r--r--base/HidlSupport.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index 2abdf1b..37f40c4 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -265,11 +265,12 @@ void hidl_string::copyFrom(const char *data, size_t size) {
void hidl_string::moveFrom(hidl_string &&other) {
// assume my resources are freed.
- mBuffer = other.mBuffer;
+ mBuffer = std::move(other.mBuffer);
mSize = other.mSize;
mOwnsBuffer = other.mOwnsBuffer;
other.mOwnsBuffer = false;
+ other.clear();
}
void hidl_string::clear() {