-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_free_memarena.c
More file actions
36 lines (33 loc) · 1.32 KB
/
Copy pathft_free_memarena.c
File metadata and controls
36 lines (33 loc) · 1.32 KB
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
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_free_memarena.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jvarila <jvarila@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/21 12:20:17 by jvarila #+# #+# */
/* Updated: 2025/03/21 12:22:12 by jvarila ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* Goes through the linked list of arenas, freeing each node.
* <p>
* Important to call with the root node when trying to feel all used memory.
*
* @param arena Pointer to primary memarena node
*/
void *ft_free_memarena(t_memarena *arena)
{
t_memarena *current;
t_memarena *next;
current = arena;
while (current)
{
next = current->next;
free(current->heap_memory);
free(current);
current = next;
}
return (NULL);
}