Fix memory leak in hidl_vec move semantic

Test: compiles
Change-Id: Ifd997413e6fe55d456abdcb23159a67101b4e290
diff --git a/include/hidl/HidlSupport.h b/include/hidl/HidlSupport.h
index 1324af5..07eebeb 100644
--- a/include/hidl/HidlSupport.h
+++ b/include/hidl/HidlSupport.h
@@ -113,8 +113,9 @@
         *this = other;
     }
 
-    hidl_vec(hidl_vec<T> &&other) {
-        *this = static_cast<hidl_vec &&>(other);
+    hidl_vec(hidl_vec<T> &&other)
+	: mOwnsBuffer(false) {
+        *this = std::move(other);
     }
 
     hidl_vec(const std::vector<T> &other) : hidl_vec() {
@@ -157,6 +158,9 @@
     }
 
     hidl_vec &operator=(hidl_vec &&other) {
+        if (mOwnsBuffer) {
+            delete[] mBuffer;
+        }
         mBuffer = other.mBuffer;
         mSize = other.mSize;
         mOwnsBuffer = other.mOwnsBuffer;