mirror of
https://github.com/CPunch/Laika.git
synced 2024-11-24 05:31:03 +00:00
Added AddressSanitizer to debug builds
- Used ASAN to fix a small memleak in lpolllist.c (forgot to free hashmap)
This commit is contained in:
parent
56c6db1d62
commit
773ea19532
@ -11,10 +11,23 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules" ${CMAKE_MODULE_PATH})
|
|||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
||||||
|
|
||||||
|
find_package(Sanitizers)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
string(TOLOWER ${CMAKE_BUILD_TYPE} RAWCMAKEBUILDTYPE)
|
||||||
|
message(STATUS "CMAKE_BUILD_TYPE: " ${RAWCMAKEBUILDTYPE})
|
||||||
|
if(RAWCMAKEBUILDTYPE STREQUAL "debug")
|
||||||
|
message(STATUS "Adding sanitizer...")
|
||||||
|
add_sanitizers(LaikaLib LaikaBot LaikaCNC)
|
||||||
|
|
||||||
|
# bug in FindSanitizer.cmake ??? idfk, i'll investigate l8tr
|
||||||
|
add_compile_options(-fsanitize=address)
|
||||||
|
add_link_options(-fsanitize=address)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# compile laikalib, tools, cnc & bot
|
# compile laikalib, tools, cnc & bot
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
|
@ -43,6 +43,7 @@ void laikaP_initPList(struct sLaika_pollList *pList) {
|
|||||||
|
|
||||||
void laikaP_cleanPList(struct sLaika_pollList *pList) {
|
void laikaP_cleanPList(struct sLaika_pollList *pList) {
|
||||||
laikaM_free(pList->revents);
|
laikaM_free(pList->revents);
|
||||||
|
hashmap_free(pList->sockets);
|
||||||
|
|
||||||
#ifdef LAIKA_USE_EPOLL
|
#ifdef LAIKA_USE_EPOLL
|
||||||
close(pList->epollfd);
|
close(pList->epollfd);
|
||||||
|
Loading…
Reference in New Issue
Block a user