ART: Destroy temporary holder in dex_ir
Ensure that a temporary wrapper is freed.
Bug: 37728266
Test: m SANITIZE_HOST=address test-art-host-gtest-dexlayout_test
Change-Id: Ib2899bce74566346f2b278d7f6c50e33add3252f
diff --git a/dexlayout/dex_ir.cc b/dexlayout/dex_ir.cc
index 3f715cf..f1c6f67 100644
--- a/dexlayout/dex_ir.cc
+++ b/dexlayout/dex_ir.cc
@@ -451,8 +451,8 @@
}
uint8_t visibility = annotation->visibility_;
const uint8_t* annotation_data = annotation->annotation_;
- EncodedValue* encoded_value =
- ReadEncodedValue(&annotation_data, DexFile::kDexAnnotationAnnotation, 0);
+ std::unique_ptr<EncodedValue> encoded_value(
+ ReadEncodedValue(&annotation_data, DexFile::kDexAnnotationAnnotation, 0));
// TODO: Calculate the size of the annotation.
AnnotationItem* annotation_item =
new AnnotationItem(visibility, encoded_value->ReleaseEncodedAnnotation());