summaryrefslogtreecommitdiffstats
path: root/libc/bionic
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2010-03-28 21:32:36 -0300
committerAndré Goddard Rosa <andre.goddard@gmail.com>2010-03-28 21:32:36 -0300
commit3f6121278194404f89ea7b22f098e9389e954587 (patch)
treedf769c6d2dfa39e91b5fec22bdfc192c173206fd /libc/bionic
parent4ad72f89b12fe0157074a253190f6aa2cbfe15ac (diff)
downloadbionic-3f6121278194404f89ea7b22f098e9389e954587.zip
bionic-3f6121278194404f89ea7b22f098e9389e954587.tar.gz
bionic-3f6121278194404f89ea7b22f098e9389e954587.tar.bz2
bionic: clear only the part of the buffer which is not overwritten afterward
Change-Id: I5ddd93f0557e5a7401460dc9fc8a55b330a79c3a Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Diffstat (limited to 'libc/bionic')
-rw-r--r--libc/bionic/malloc_leak.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libc/bionic/malloc_leak.c b/libc/bionic/malloc_leak.c
index ad1d2b4..06f99fb 100644
--- a/libc/bionic/malloc_leak.c
+++ b/libc/bionic/malloc_leak.c
@@ -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;