summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-05-07 14:46:36 -0700
committerRomain Guy <romainguy@google.com>2013-05-07 14:46:36 -0700
commitd5207b2eb9ba520da822d61ff78b539842fc5255 (patch)
treef3449605d3384037f9d64f33ada123534dec262b /libs
parent2ae118d1077bcec1c407b6ecb9acf14e2152fe93 (diff)
downloadframeworks_base-d5207b2eb9ba520da822d61ff78b539842fc5255.zip
frameworks_base-d5207b2eb9ba520da822d61ff78b539842fc5255.tar.gz
frameworks_base-d5207b2eb9ba520da822d61ff78b539842fc5255.tar.bz2
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
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/AssetAtlas.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/AssetAtlas.cpp b/libs/hwui/AssetAtlas.cpp
index d8c9071..4d2fc01 100644
--- a/libs/hwui/AssetAtlas.cpp
+++ b/libs/hwui/AssetAtlas.cpp
@@ -39,13 +39,17 @@ void AssetAtlas::init(sp<GraphicBuffer> buffer, int* map, int count) {
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);