modernc.org/libc@v1.24.1/testdata/memgrind/badfree.c (about)

     1  // This program attempts to free a pointer not acquired by malloc/calloc/realloc.
     2  //
     3  // Compile to Go: `$ ccgo -o main.go badfree.c`.
     4  //
     5  // To run the resulting Go code: `$ go run main.go`.
     6  //
     7  // To run the resulting Go code with memgrind: `$ go run -tags=libc.memgrind main.go`.
     8  
     9  #include <stdlib.h>
    10  
    11  int main() {
    12  	int i;
    13  	free(&i);
    14  }
    15