ART: Fix missing Erase() in error case
Fixes an abort for unclosed file.
Change-Id: Iae46fd89724f6f77a2b0a8c40293532e56153c2e
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index c7f81ea..d238b2c 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -137,6 +137,7 @@
if (oat_file_ == nullptr) {
PLOG(ERROR) << "Failed to open writable oat file " << oat_filename << " for " << oat_location
<< ": " << error_msg;
+ oat_file->Erase();
return false;
}
CHECK_EQ(class_linker->RegisterOatFile(oat_file_), oat_file_);