status-go/vendor/modernc.org/libc/testdata/memgrind/doublefree.c

17 lines
328 B
C
Raw Permalink Normal View History

2024-03-07 11:42:38 +00:00
// This program frees allocated memory twice.
//
// Compile to Go: `$ ccgo -o main.go doublefree.c`.
//
// To run the resulting Go code: `$ go run main.go`.
//
// To run the resulting Go code with memgrind: `$ go run -tags=libc.memgrind main.go`.
#include <stdlib.h>
int main() {
void *p = malloc(42);
free(p);
free(p);
}