Why is address sanitizer not detecting this simple memory leak?

  address-sanitizer, c++, cmake

Does anybody have any idea why address sanitizer is not flagging this very obvious memory leak

class A {
public:
    A() = default;
};

TEST_F(LibrdfSerializerTests, Test) {
    A* a = new A;
}

built with the following added to cmake:

    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
    set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")

Source: Windows Questions C++

LEAVE A COMMENT