diff --git a/test/simple-memory-corruption/Makefile b/test/simple-memory-corruption/Makefile index 4072f0c..e3cf7e1 100644 --- a/test/simple-memory-corruption/Makefile +++ b/test/simple-memory-corruption/Makefile @@ -1,6 +1,8 @@ EXECUTABLES := \ double_free_large \ + double_free_large_delayed \ double_free_small \ + double_free_small_delayed \ unaligned_free_large \ unaligned_free_small \ read_after_free_large \ diff --git a/test/simple-memory-corruption/double_free_large_delayed.c b/test/simple-memory-corruption/double_free_large_delayed.c new file mode 100644 index 0000000..b448ea9 --- /dev/null +++ b/test/simple-memory-corruption/double_free_large_delayed.c @@ -0,0 +1,17 @@ +#include + +__attribute__((optimize(0))) +int main(void) { + void *p = malloc(128 * 1024); + if (!p) { + return 1; + } + void *q = malloc(128 * 1024); + if (!q) { + return 1; + } + free(p); + free(q); + free(p); + return 0; +} diff --git a/test/simple-memory-corruption/double_free_small_delayed.c b/test/simple-memory-corruption/double_free_small_delayed.c new file mode 100644 index 0000000..63d8586 --- /dev/null +++ b/test/simple-memory-corruption/double_free_small_delayed.c @@ -0,0 +1,17 @@ +#include + +__attribute__((optimize(0))) +int main(void) { + void *p = malloc(16); + if (!p) { + return 1; + } + void *q = malloc(16); + if (!q) { + return 1; + } + free(p); + free(q); + free(p); + return 0; +}