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

     1  // This program frees allocated memory twice.
     2  //
     3  // Compile to Go: `$ ccgo -o main.go doublefree.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  	void *p = malloc(42);
    13  	free(p);
    14  	free(p);
    15  }
    16