-
Notifications
You must be signed in to change notification settings - Fork 0
/
freeprocesses.c
42 lines (37 loc) · 1.25 KB
/
freeprocesses.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* freeprocesses.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: snocita <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 17:13:17 by snocita #+# #+# */
/* Updated: 2023/02/14 17:25:13 by snocita ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
void freemainprocess(t_pipex *pipex)
{
int i;
i = 0;
close(pipex->infile);
close(pipex->outfile);
while (pipex->cmd_paths[i])
{
free(pipex->cmd_paths[i]);
i++;
}
free(pipex->cmd_paths);
}
void freesubprocess(t_pipex *pipex)
{
int i;
i = 0;
while (pipex->cmd_args[i])
{
free(pipex->cmd_args[i]);
i++;
}
free(pipex->cmd_args);
free(pipex->cmd);
}