Merge "Fix the Vector erase bug"
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 987e306..f7bdf3a 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -880,14 +880,14 @@
         for (android::Vector<grant_t*>::iterator it(mGrants.begin());
                 it != mGrants.end(); it++) {
             delete *it;
-            mGrants.erase(it);
         }
+        mGrants.clear();
 
         for (android::Vector<UserState*>::iterator it(mMasterKeys.begin());
                 it != mMasterKeys.end(); it++) {
             delete *it;
-            mMasterKeys.erase(it);
         }
+        mMasterKeys.clear();
     }
 
     keymaster_device_t* getDevice() const {