summaryrefslogtreecommitdiffstats
path: root/libs/androidfw/AssetManager.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-29 13:12:55 -0700
committerElliott Hughes <enh@google.com>2013-10-29 13:12:55 -0700
commitc367d48c55e5a3fa0df14fd62889e4bb6b63cb01 (patch)
treecc6a7e56e5c5e74d66603c8170660fd99c52bff3 /libs/androidfw/AssetManager.cpp
parentb4cae4a955ebd91cf35aaeb00ab12ce6f1d5fc48 (diff)
downloadframeworks_base-c367d48c55e5a3fa0df14fd62889e4bb6b63cb01.zip
frameworks_base-c367d48c55e5a3fa0df14fd62889e4bb6b63cb01.tar.gz
frameworks_base-c367d48c55e5a3fa0df14fd62889e4bb6b63cb01.tar.bz2
Fix a variety of small publicly-reported bugs.
Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp. https://code.google.com/p/android/issues/detail?id=61556 Missing fclose in core/jni/android_os_Debug.cpp. https://code.google.com/p/android/issues/detail?id=61546 Bad loop guards in core/jni/android_util_Process.cpp. https://code.google.com/p/android/issues/detail?id=61557 Assignment to wrong variable in libs/androidfw/AssetManager.cpp. https://code.google.com/p/android/issues/detail?id=61560 Missing delete[]s in libs/androidfw/ObbFile.cpp. https://code.google.com/p/android/issues/detail?id=61549 Leaks on error in tools/aapt/Images.cpp. https://code.google.com/p/android/issues/detail?id=61552 Two missing fclose calls in tools/aapt/Resource.cpp. https://code.google.com/p/android/issues/detail?id=61553 Missing fclose in tools/aidl/aidl.cpp. https://code.google.com/p/android/issues/detail?id=61554 Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
Diffstat (limited to 'libs/androidfw/AssetManager.cpp')
-rw-r--r--libs/androidfw/AssetManager.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index b08c36b..9156725 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -431,7 +431,7 @@ void AssetManager::setLocaleLocked(const char* locale)
delete[] mLocale;
}
mLocale = strdupNew(locale);
-
+
updateResourceParamsLocked();
}
@@ -674,7 +674,7 @@ const ResTable* AssetManager::getResTable(bool required) const
mZipSet.setZipResourceTableAsset(ap.path, ass);
}
}
-
+
if (i == 0 && ass != NULL) {
// If this is the first resource table in the asset
// manager, then we are going to cache it so that we
@@ -688,7 +688,7 @@ const ResTable* AssetManager::getResTable(bool required) const
}
} else {
ALOGV("loading resource table %s\n", ap.path.string());
- Asset* ass = const_cast<AssetManager*>(this)->
+ ass = const_cast<AssetManager*>(this)->
openNonAssetInPathLocked("resources.arsc",
Asset::ACCESS_BUFFER,
ap);
@@ -890,7 +890,7 @@ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode m
/* look at the filesystem on disk */
String8 path(createPathNameLocked(ap, locale, vendor));
path.appendPath(fileName);
-
+
String8 excludeName(path);
excludeName.append(kExcludeExtension);
if (::getFileType(excludeName.string()) != kFileTypeNonexistent) {
@@ -898,28 +898,28 @@ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode m
//printf("+++ excluding '%s'\n", (const char*) excludeName);
return kExcludedAsset;
}
-
+
pAsset = openAssetFromFileLocked(path, mode);
-
+
if (pAsset == NULL) {
/* try again, this time with ".gz" */
path.append(".gz");
pAsset = openAssetFromFileLocked(path, mode);
}
-
+
if (pAsset != NULL)
pAsset->setAssetSource(path);
} else {
/* find in cache */
String8 path(createPathNameLocked(ap, locale, vendor));
path.appendPath(fileName);
-
+
AssetDir::FileInfo tmpInfo;
bool found = false;
-
+
String8 excludeName(path);
excludeName.append(kExcludeExtension);
-
+
if (mCache.indexOf(excludeName) != NAME_NOT_FOUND) {
/* go no farther */
//printf("+++ Excluding '%s'\n", (const char*) excludeName);
@@ -1738,7 +1738,7 @@ bool AssetManager::fncScanAndMergeDirLocked(
// XXX This is broken -- the filename cache needs to hold the base
// asset path separately from its filename.
-
+
partialPath = createPathNameLocked(ap, locale, vendor);
if (dirName[0] != '\0') {
partialPath.appendPath(dirName);