diff options
author | Narayan Kamath <narayan@google.com> | 2014-06-24 14:16:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-24 06:22:45 +0000 |
commit | 71dfc7e9accc1ca3cda52bdf475b03fa2a334e78 (patch) | |
tree | 4364fd85bd976ee1456792b346069c1a0b889e27 /libs/androidfw | |
parent | 2a0f9e6a523abc28bdbc249010f5ddd184a27730 (diff) | |
parent | 5f7ce10c937abf7da6d547ae91bda495dfbc414d (diff) | |
download | frameworks_base-71dfc7e9accc1ca3cda52bdf475b03fa2a334e78.zip frameworks_base-71dfc7e9accc1ca3cda52bdf475b03fa2a334e78.tar.gz frameworks_base-71dfc7e9accc1ca3cda52bdf475b03fa2a334e78.tar.bz2 |
Merge "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 1ffe665..2c828c1 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -5405,23 +5405,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"); |