diff options
author | Narayan Kamath <narayan@google.com> | 2014-06-24 14:26:45 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-24 14:26:45 +0000 |
commit | 70bf06986a90c21137fc4836aa0e56d68a2ab588 (patch) | |
tree | b8d6571df7835d92bde738bf44e0ce136ad25bd0 /libs/androidfw | |
parent | ed8b77e668dbc8aa4a8c2a108dce98f2900cc5b3 (diff) | |
parent | b20b0629c2ea6a8e1f7bebd0791dd21e545a4605 (diff) | |
download | frameworks_base-70bf06986a90c21137fc4836aa0e56d68a2ab588.zip frameworks_base-70bf06986a90c21137fc4836aa0e56d68a2ab588.tar.gz frameworks_base-70bf06986a90c21137fc4836aa0e56d68a2ab588.tar.bz2 |
am b20b0629: am 71dfc7e9: Merge "Memory leak in parsePackage"
* commit 'b20b0629c2ea6a8e1f7bebd0791dd21e545a4605':
Memory leak in parsePackage
Diffstat (limited to 'libs/androidfw')
-rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 9e59a13..b84bee8 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -5408,23 +5408,33 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, return (mError=err); } + err = group->packages.add(package); + if (err < NO_ERROR) { + delete group; + delete package; + return (mError=err); + } + group->basePackage = package; + //printf("Adding new package id %d at index %d\n", id, idx); err = mPackageGroups.add(group); if (err < NO_ERROR) { + delete group; return (mError=err); } - group->basePackage = package; mPackageMap[id] = (uint8_t)idx; } else { group = mPackageGroups.itemAt(idx-1); if (group == NULL) { + delete package; return (mError=UNKNOWN_ERROR); } - } - err = group->packages.add(package); - if (err < NO_ERROR) { - return (mError=err); + err = group->packages.add(package); + if (err < NO_ERROR) { + delete package; + return (mError=err); + } } } else { LOG_ALWAYS_FATAL("Package id out of range"); |