Fix double-free in AssetAtlas
Bug #8833153

If Atlas::terminate() is called twice without an init() in between
libhwui would double-free Atlas::mImage. This lead to a lot of crashes
with the monkeys as they can easily trigger memory trims.

Change-Id: I96798414e5e71cd498aaca85a790661ebccdaa91
diff --git a/libs/hwui/AssetAtlas.cpp b/libs/hwui/AssetAtlas.cpp
index d8c9071..4d2fc014 100644
--- a/libs/hwui/AssetAtlas.cpp
+++ b/libs/hwui/AssetAtlas.cpp
@@ -39,13 +39,17 @@
 
         createEntries(map, count);
     } else {
+        ALOGW("Could not create atlas image");
+
         delete mImage;
+        mImage = NULL;
     }
 }
 
 void AssetAtlas::terminate() {
     if (mImage) {
         delete mImage;
+        mImage = NULL;
 
         for (size_t i = 0; i < mEntries.size(); i++) {
             delete mEntries.valueAt(i);