-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfree.c
43 lines (38 loc) · 1.32 KB
/
free.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
32
33
34
35
36
37
38
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kristori <kristori@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/28 10:44:38 by kristori #+# #+# */
/* Updated: 2023/04/05 14:52:06 by kristori ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void ft_free(char **str)
{
int i;
i = 0;
while (str[i])
{
free(str[i]);
i++;
}
free(str);
}
void ft_free_list(t_list *list)
{
t_list *tmp;
while (list != NULL)
{
tmp = list;
ft_free(((t_mini *)list->content)->full_cmd);
free(((t_mini *)list->content)->full_path);
free(((t_mini *)list->content)->built_in);
free(((t_mini *)list->content)->here_doc);
free(list->content);
list = list->next;
free(tmp);
}
}