From a1d82ff39315c962fbd6839f7a581ffaafe675e4 Mon Sep 17 00:00:00 2001 From: Chris Dearman Date: Mon, 8 Oct 2012 12:22:02 -0700 Subject: Free resources in correct order in ResStringPool::uninit mOwnedData contains the mHeader data structure Change-Id: I0ae9ba3a0d18fc3f368c629501fadebce8807198 --- libs/androidfw/ResourceTypes.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 8cce191e3e8b..a4b444632d9a 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -506,10 +506,6 @@ status_t ResStringPool::getError() const void ResStringPool::uninit() { mError = NO_INIT; - if (mOwnedData) { - free(mOwnedData); - mOwnedData = NULL; - } if (mHeader != NULL && mCache != NULL) { for (size_t x = 0; x < mHeader->stringCount; x++) { if (mCache[x] != NULL) { @@ -520,6 +516,10 @@ void ResStringPool::uninit() free(mCache); mCache = NULL; } + if (mOwnedData) { + free(mOwnedData); + mOwnedData = NULL; + } } /** -- cgit v1.2.3-59-g8ed1b