aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/malloc_debug_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/bionic/malloc_debug_common.c')
-rw-r--r--libc/bionic/malloc_debug_common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libc/bionic/malloc_debug_common.c b/libc/bionic/malloc_debug_common.c
index b9fcbc49b..6837e393d 100644
--- a/libc/bionic/malloc_debug_common.c
+++ b/libc/bionic/malloc_debug_common.c
@@ -298,6 +298,7 @@ static void malloc_init_impl(void)
unsigned int memcheck_enabled = 0;
char env[PROP_VALUE_MAX];
char memcheck_tracing[PROP_VALUE_MAX];
+ char debug_program[PROP_VALUE_MAX];
/* Get custom malloc debug level. Note that emulator started with
* memory checking option will have priority over debug level set in
@@ -325,6 +326,15 @@ static void malloc_init_impl(void)
return;
}
+ /* If libc.debug.malloc.program is set and is not a substring of progname,
+ * then exit.
+ */
+ if (__system_property_get("libc.debug.malloc.program", debug_program)) {
+ if (!strstr(__progname, debug_program)) {
+ return;
+ }
+ }
+
// Lets see which .so must be loaded for the requested debug level
switch (debug_level) {
case 1: