Merge "bionic: clear only the part of the buffer which is not overwritten afterward"

This commit is contained in:
David Turner 2010-03-30 14:52:14 -07:00 committed by Android Code Review
commit f8916e2e45

View File

@ -211,8 +211,7 @@ void get_malloc_leak_info(uint8_t** info, size_t* overallSize,
size_t entrySize = (sizeof(size_t) * 2) + (sizeof(intptr_t) * entry->numEntries);
if (entrySize < *infoSize) {
/* we're writing less than a full entry, clear out the rest */
/* TODO: only clear out the part we're not overwriting? */
memset(head, 0, *infoSize);
memset(head + entrySize, 0, *infoSize - entrySize);
} else {
/* make sure the amount we're copying doesn't exceed the limit */
entrySize = *infoSize;