Add leak_detector_c
This commit is contained in:
20
leak_detector_c/test.c
Normal file
20
leak_detector_c/test.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include "leak_detector_c.h"
|
||||
int main()
|
||||
{
|
||||
atexit(report_mem_leak);
|
||||
|
||||
char *ptr1 = (char *)malloc(1);
|
||||
|
||||
|
||||
|
||||
|
||||
int *ptr2 = (int *)calloc(1, sizeof(int));
|
||||
float * ptr3 = (float *) calloc(15, sizeof(float));
|
||||
free(ptr2);
|
||||
|
||||
dump_mem_leak();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user