Skip to content

Commit 403feaa

Browse files
committed
Add leak sanitizer
1 parent e8c853a commit 403feaa

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/ubuntu.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ jobs:
386386
run: >
387387
cmake -S . -B build -G Ninja
388388
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
389-
-D CMAKE_BUILD_TYPE=RELEASE -D ENABLE_ADDRESS_SANITIZER=ON -D ENABLE_UB_SANITIZER=ON
389+
-D CMAKE_BUILD_TYPE=RELEASE
390+
-D ENABLE_ADDRESS_SANITIZER=ON -D ENABLE_UB_SANITIZER=ON -D ENABLE_LEAK_SANITIZER=ON
390391
-D CMAKE_INSTALL_PREFIX=install
391392
env:
392393
CC: clang-20

cmake/sanitizers.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
1010
add_link_options(-fsanitize=undefined -fno-sanitize=signed-integer-overflow)
1111
message(STATUS "Enabled UB sanitizer")
1212
endif()
13+
if (ENABLE_LEAK_SANITIZER)
14+
add_compile_options(-fsanitize=leak)
15+
add_link_options(-fsanitize=leak)
16+
message(STATUS "Enabled leak sanitizer")
17+
endif()
1318
else()
1419
message(WARNING "Sanitizers are supported on gcc and clang compilers only!")
1520
endif()

0 commit comments

Comments
 (0)