Skip to content

Commit ab1444f

Browse files
committed
[lsan] Fix free(NULL) interception during initialization
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).
1 parent 984fca5 commit ab1444f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler-rt/lib/lsan/lsan_interceptors.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ INTERCEPTOR(void*, malloc, uptr size) {
7777
}
7878

7979
INTERCEPTOR(void, free, void *p) {
80+
if (!p)
81+
return;
8082
if (DlsymAlloc::PointerIsMine(p))
8183
return DlsymAlloc::Free(p);
8284
ENSURE_LSAN_INITED;

0 commit comments

Comments
 (0)