Skip to content

Commit

Permalink
[lsan] Fix free(NULL) interception during initialization
Browse files Browse the repository at this point in the history
Previously an attempt to free a null pointer during initialization would
fail on ENSURE_LSAN_INITED assertion (since a null pointer is not owned
by DlsymAlloc).
  • Loading branch information
tmiasko committed Sep 11, 2024
1 parent 96b7c64 commit 6bbc9f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler-rt/lib/lsan/lsan_interceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ INTERCEPTOR(void*, malloc, uptr size) {
}

INTERCEPTOR(void, free, void *p) {
if (UNLIKELY(!p))
return;
if (DlsymAlloc::PointerIsMine(p))
return DlsymAlloc::Free(p);
ENSURE_LSAN_INITED;
Expand Down

0 comments on commit 6bbc9f9

Please sign in to comment.