summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author George Burgess IV <gbiv@google.com> 2016-10-18 01:43:24 +0000
committer android-build-merger <android-build-merger@google.com> 2016-10-18 01:43:24 +0000
commit1db1a86bbafb63b9c3cfb7d7f41e468a71fec4cc (patch)
treecf0b7a68f37704450449dba9111ac2dbf26fe86e
parent086be31642b6d25f25bdf47ea92c715cb30592a8 (diff)
parentff5c3ad08b186e71b7b1466c576c5d44f05746ca (diff)
Merge "Fix static analyzer warnings."
am: ff5c3ad08b Change-Id: I655fd765cfeae407c070261cfe07ce8b739b06fa
-rw-r--r--libs/androidfw/ResourceTypes.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index c91b27d04778..10a0a23392b3 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -739,7 +739,7 @@ const char16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const
ALOGW("CREATING STRING CACHE OF %zu bytes",
static_cast<size_t>(mHeader->stringCount*sizeof(char16_t**)));
#endif
- mCache = (char16_t**)calloc(mHeader->stringCount, sizeof(char16_t**));
+ mCache = (char16_t**)calloc(mHeader->stringCount, sizeof(char16_t*));
if (mCache == NULL) {
ALOGW("No memory trying to allocate decode cache table of %d bytes\n",
(int)(mHeader->stringCount*sizeof(char16_t**)));
@@ -4352,10 +4352,12 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
if (set->numAttrs >= set->availAttrs) {
// Need to alloc more memory...
const size_t newAvail = set->availAttrs+N;
+ void *oldSet = set;
set = (bag_set*)realloc(set,
sizeof(bag_set)
+ sizeof(bag_entry)*newAvail);
if (set == NULL) {
+ free(oldSet);
return NO_MEMORY;
}
set->availAttrs = newAvail;
@@ -4402,7 +4404,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
pos++;
const size_t size = dtohs(map->value.size);
curOff += size + sizeof(*map)-sizeof(map->value);
- };
+ }
if (curEntry > set->numAttrs) {
set->numAttrs = curEntry;