Can Google's Leak Sanitizer report leaks if the program crashes?

132 Views Asked by At

The following program crashes at the null-pointer dereference:

#include <stdlib.h>

char *p;

int main(void) {
    p = malloc(42);
    p = NULL;
    *p = 0;
    return 0;
}

When executed with Valgrind, the memory leak is still reported (despite the crash). However, when using Leak Sanitizer by compiling the program with -fsanitize=leak, the program crashes and the leak gets unreported.

Is there a way to obtain a report from Leak Sanitizer when the program crashes?

0

There are 0 best solutions below