Why isn't address sanitizer flagging a memory leak in this obvious memory leak? (Note that this is a googletest unittest but could also be in a main function.
TEST_F(SresTests, test){
double* x = (double*) malloc(sizeof(double)*10);
for (int i=0; i<10; i++){
x[i] = 0.1;
}
}
I'm compiling this in cmake using
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -g")
On macos using Apple Clang version 12.0.0.