[compiler-rt] [lsan] Fix free(NULL) interception during initialization (PR #106912)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 11:00:39 PDT 2024
================
@@ -77,6 +77,8 @@ INTERCEPTOR(void*, malloc, uptr size) {
}
INTERCEPTOR(void, free, void *p) {
+ if (!p)
----------------
tmiasko wrote:
I updated the patch to include UNLIKELY in the condition.
For lsan cfree interceptor is aliased to free and doesn't need further changes.
I looked a little bit more at other sanitizers and I don't think they actually need any further changes. For those that don't immediately return for null, it is fine if execution just falls through to the main deallocation function, since null case is handled early on there.
https://github.com/llvm/llvm-project/pull/106912
More information about the llvm-commits
mailing list