fix a corruption in Vector<> when adding new items

would happen when vectors are copied and new items is
added in both vectors. we didn't duplicate the underlying
storage when adding items in vectors.

Bug: 6515797
Change-Id: If544c07d96c05821e088d7f2c9b5736f7e306c31
diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp
index 220ae3e..e78faa8 100644
--- a/libs/utils/VectorImpl.cpp
+++ b/libs/utils/VectorImpl.cpp
@@ -382,8 +382,8 @@
             }
         }
     } else {
+        void* array = editArrayImpl();
         if (where != mCount) {
-            void* array = editArrayImpl();
             const void* from = reinterpret_cast<const uint8_t *>(array) + where*mItemSize;
             void* to = reinterpret_cast<uint8_t *>(array) + (where+amount)*mItemSize;
             _do_move_forward(to, from, mCount - where);