I malloced two dimensional arrays and one dimensional array. it's like
int *each_len = (int *)malloc(sizeof(int) * (total_line));
char **arr = malloc(sizeof(char *) * (total_line + 1));
t_dict *dict = malloc(sizeof(t_dict) * (total_line + 1));
After I used them I checked if memory is leaking before the main function ends. it is like
int main(void)
{
int total_line;
int *each_len;
char **arr;
t_dict *dict;
total_line = get_linenum();
each_len = (int *)malloc(sizeof(int) * (total_line));
arr = malloc(sizeof(char *) * (total_line + 1));
dict = malloc(sizeof(t_dict) * (total_line + 1));
len_store(each_len);
store_line(arr, each_len);
set_dict(dict, arr, total_line);
divider(342, dict);
// free(each_len);
// free_arr(arr, total_line);
// free_dict(dict, total_line);
system("leaks a.out > leaks_result_temp; cat leaks_result_temp | grep leaked && rm -rf leaks_result_temp");
return (0);
}
The problem is even if I didn't free my allocated space, the message tells me there is no leak.
Process 46827: 0 leaks for 0 total leaked bytes.
why is this happening? I didn't free them so they should be leaked right?? is this spaces automatically freed?
if i use just "system("leaks a.out") it shows
leaks Report Version: 4.0
Process 47508: 240 nodes malloced for 11 KB
Process 47508: 0 leaks for 0 total leaked bytes.