Ignore the redundant InferredRegCategoryMap.
The verifier may verify the same class more than once.
Thus, it is possible for us to "Put" the same key-value
pair to the "SafeMap" more than once. In this case,
just ignore the redundant key-value pair.
NOTE: Since soft verification failure is not considered
as erroneous, we may invoke VerifyClass again while we
are verifying the subclass, which will verify its super
class if it is not successfully verified or in erroneous
state.
Change-Id: Ifbd817b6e00c9b452ebbf1140750025ff261ef1e
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index ccc83da..178c2a9 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -3436,12 +3436,13 @@
MutexLock mu(*inferred_reg_category_maps_lock_);
const InferredRegCategoryMap* existing_inferred_reg_category_map = GetInferredRegCategoryMap(ref);
- if (existing_inferred_reg_category_map != NULL) {
+ if (existing_inferred_reg_category_map == NULL) {
+ inferred_reg_category_maps_->Put(ref, &inferred_reg_category_map);
+ } else {
CHECK(*existing_inferred_reg_category_map == inferred_reg_category_map);
- delete existing_inferred_reg_category_map;
+ delete &inferred_reg_category_map;
}
- inferred_reg_category_maps_->Put(ref, &inferred_reg_category_map);
CHECK(GetInferredRegCategoryMap(ref) != NULL);
}