diff options
author | Josh Gao <jmgao@google.com> | 2018-02-28 23:16:34 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-02-28 23:16:34 +0000 |
commit | 0e459e1d4782317745837a66a120f4b8b1888963 (patch) | |
tree | e776c9c44e258e3a592053871ea7e0fe6f2a41a6 /adb | |
parent | 61421baf96b45168ff7039d6c6b3e0649dcfb31d (diff) | |
parent | 399c3591f25ce576bf7c263711683864c36354e9 (diff) | |
download | core-0e459e1d4782317745837a66a120f4b8b1888963.tar.gz core-0e459e1d4782317745837a66a120f4b8b1888963.tar.bz2 core-0e459e1d4782317745837a66a120f4b8b1888963.zip |
Merge "adb: add a way to make the server intentionally leak." am: 1ac7150590 am: 9ba182e3bb
am: 399c3591f2
Change-Id: Ifa340ad4f3ce53786391722a7d4f8b97816dfd20
Diffstat (limited to 'adb')
-rw-r--r-- | adb/client/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/adb/client/main.cpp b/adb/client/main.cpp index f28302b61..e5666bc8d 100644 --- a/adb/client/main.cpp +++ b/adb/client/main.cpp @@ -75,6 +75,11 @@ void adb_server_cleanup() { usb_cleanup(); } +static void intentionally_leak() { + void* p = ::operator new(1); + LOG(INFO) << "leaking pointer " << p; +} + int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply_fd) { #if defined(_WIN32) // adb start-server starts us up with stdout and stderr hooked up to @@ -98,6 +103,11 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply }); #endif + char* leak = getenv("ADB_LEAK"); + if (leak && strcmp(leak, "1") == 0) { + intentionally_leak(); + } + if (is_daemon) { close_stdin(); setup_daemon_logging(); |