summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-01-30 19:53:49 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-01-30 19:53:49 +0000
commite1a124e5c93b59e2b6792e4de8a2c72dc0a78be1 (patch)
tree0da27f2238592c5bb074afe229e97b802ddb6161
parenta990cf5b3392c5aef767aee1e67b4d7ef651afc6 (diff)
parent1d12d574169cedd68185196e4957597d00fd4681 (diff)
downloadbionic-e1a124e5c93b59e2b6792e4de8a2c72dc0a78be1.zip
bionic-e1a124e5c93b59e2b6792e4de8a2c72dc0a78be1.tar.gz
bionic-e1a124e5c93b59e2b6792e4de8a2c72dc0a78be1.tar.bz2
Merge "Say explicitly if there were no leaks."
-rw-r--r--libc/bionic/malloc_debug_check.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libc/bionic/malloc_debug_check.cpp b/libc/bionic/malloc_debug_check.cpp
index 18c3ed4..394b8bb 100644
--- a/libc/bionic/malloc_debug_check.cpp
+++ b/libc/bionic/malloc_debug_check.cpp
@@ -437,10 +437,6 @@ extern "C" void *chk_calloc(int nmemb, size_t size) {
}
static void heaptracker_free_leaked_memory() {
- if (gAllocatedBlockCount == 0) {
- return;
- }
-
// Use /proc/self/exe link to obtain the program name for logging
// purposes. If it's not available, we set it to "<unknown>".
char exe[PATH_MAX];
@@ -451,6 +447,11 @@ static void heaptracker_free_leaked_memory() {
exe[count] = '\0';
}
+ if (gAllocatedBlockCount == 0) {
+ log_message("+++ %s did not leak", exe);
+ return;
+ }
+
size_t index = 1;
const size_t total = gAllocatedBlockCount;
while (head != NULL) {