forked from TheAlgorithms/C
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_malloc_dbg.c
31 lines (26 loc) · 915 Bytes
/
test_malloc_dbg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @file
* @brief File used to test the malloc_dbg, calloc_dbg and free_dbg functions.
* @details
* This file only have a main function that calls malloc, calloc and free.
* When the program exits, memory leaks must be printed.
* @author [tinouduart33](https://github.com/tinouduart33)
* @see malloc_dbg.c, malloc_dbg.h
*/
#include <stdio.h> /// For IO operations if needed.
#include <stdlib.h> /// For the EXIT_SUCCESS macro and the "real" malloc, calloc and free functions.
#include "malloc_dbg.h" /// For the macros malloc, calloc and free and the malloc_dbg, calloc_dbg and free_dbg functions.
/**
* @brief Main function
* @param argc number of arguments (not used)
* @param argv list of arguments (not used)
* @returns 0 on exit
*/
int main(int argc, char* argv[])
{
int* iptr = malloc(10 * sizeof(int));
char* cptr = calloc(256, sizeof(char));
free(iptr);
// free(cptr);
return 0;
}