Hidl: Let ASAN know that hidl-gen doesn't want lsan
hidl-gen is intentionally leaking internal structures. Ask to turn
off the leak detection by default.
This is in code, as otherwise generated makefiles would have to
use ASAN_OPTIONS=... at every invocation.
Bug: 37758781
Test: ASAN_OPTIONS= SANITIZE_HOST=address m
Change-Id: Ice7229a42e8814428c1e81aba2d7712e37f76a2c
diff --git a/main.cpp b/main.cpp
index 34795aa..003a0cb 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1277,6 +1277,11 @@
"(e.g., android.hardware:hardware/interfaces)\n");
}
+// hidl is intentionally leaky. Turn off LeakSanitizer by default.
+extern "C" const char *__asan_default_options() {
+ return "detect_leaks=0";
+}
+
int main(int argc, char **argv) {
std::string outputPath;
std::vector<std::string> packageRootPaths;