am fb55511e: am e1a124e5: Merge "Say explicitly if there were no leaks."
# Via Android Git Automerger (1) and others
* commit 'fb55511e71900476fd03f9c490dc60269d076d1f':
Say explicitly if there were no leaks.
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 @@
}
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 @@
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) {