Factor the common code out of cf_free and mz_free.
Introduce the mac_ignore_invalid_free flag (0 by default) which makes both cf_free and mz_free ignore invalid free invocations and leak memory.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158885 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index 9e0909c..be05ef3 100644
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -73,6 +73,7 @@
s64 FLAG_demangle = 1;
s64 FLAG_debug = 0;
bool FLAG_replace_cfallocator = 1; // Used on Mac only.
+bool FLAG_mac_ignore_invalid_free = 0; // Used on Mac only.
bool FLAG_replace_str = 1;
bool FLAG_replace_intrin = 1;
bool FLAG_use_fake_stack = 1;
@@ -458,6 +459,7 @@
IntFlagValue(options, "demangle=", &FLAG_demangle);
IntFlagValue(options, "debug=", &FLAG_debug);
BoolFlagValue(options, "replace_cfallocator=", &FLAG_replace_cfallocator);
+ BoolFlagValue(options, "mac_ignore_invalid_free=", &FLAG_mac_ignore_invalid_free);
BoolFlagValue(options, "replace_str=", &FLAG_replace_str);
BoolFlagValue(options, "replace_intrin=", &FLAG_replace_intrin);
BoolFlagValue(options, "use_fake_stack=", &FLAG_use_fake_stack);