mirror of
https://github.com/nganhkhoa/CTF-All-In-One.git
synced 2025-06-24 04:05:03 +07:00
finish 5.9
This commit is contained in:
12
src/others/4.3_gcc_arg/t_mcheck.c
Normal file
12
src/others/4.3_gcc_arg/t_mcheck.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void main() {
|
||||
char *p;
|
||||
p = malloc(1000);
|
||||
fprintf(stderr, "About to free\n");
|
||||
free(p);
|
||||
fprintf(stderr, "About to free a second time\n");
|
||||
free(p);
|
||||
fprintf(stderr, "Finish\n");
|
||||
}
|
21
src/others/4.3_gcc_arg/t_mtrace.c
Normal file
21
src/others/4.3_gcc_arg/t_mtrace.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <mcheck.h>
|
||||
|
||||
void main() {
|
||||
char *p;
|
||||
|
||||
mtrace();
|
||||
|
||||
calloc(16, 16);
|
||||
fprintf(stderr, "calloc some chunks that will not be freed\n");
|
||||
|
||||
p = malloc(1000);
|
||||
fprintf(stderr, "About to free\n");
|
||||
free(p);
|
||||
fprintf(stderr, "About to free a second time\n");
|
||||
free(p);
|
||||
fprintf(stderr, "Finish\n");
|
||||
|
||||
muntrace();
|
||||
}
|
Reference in New Issue
Block a user