Zero-initialize hidl_vec data am: 97e2d175cf
am: 4d05bb9298

Change-Id: I72a051674ba9b80620ad26e501023c959de0ce67
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 112336f..56b6160 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -372,7 +372,7 @@
             details::logAlwaysFatal("size can't be negative.");
         }
         mSize = static_cast<uint32_t>(size);
-        mBuffer = new T[mSize];
+        mBuffer = new T[mSize]();
         mOwnsBuffer = true;
 
         size_t idx = 0;
@@ -458,7 +458,7 @@
             delete[] mBuffer;
         }
         mSize = static_cast<uint32_t>(list.size());
-        mBuffer = new T[mSize];
+        mBuffer = new T[mSize]();
         mOwnsBuffer = true;
 
         size_t idx = 0;
@@ -512,7 +512,7 @@
         if (size > UINT32_MAX) {
             details::logAlwaysFatal("hidl_vec can't hold more than 2^32 elements.");
         }
-        T *newBuffer = new T[size];
+        T* newBuffer = new T[size]();
 
         for (size_t i = 0; i < std::min(static_cast<uint32_t>(size), mSize); ++i) {
             newBuffer[i] = mBuffer[i];
@@ -589,7 +589,7 @@
         mSize = static_cast<uint32_t>(size);
         mOwnsBuffer = true;
         if (mSize > 0) {
-            mBuffer = new T[size];
+            mBuffer = new T[size]();
             for (size_t i = 0; i < size; ++i) {
                 mBuffer[i] = data[i];
             }