1 2 3 4 5 6 7 8 9
#include <stdlib.h> void *ptr; void *test (void) { ptr = malloc (1024); ptr = NULL; /* { dg-warning "leak of 'ptr'" } */ }