forked from YerardinPerlaza/simple_shell
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_free.c
37 lines (31 loc) · 547 Bytes
/
_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
#include "headers.h"
/**
* _free_double_pointer - Entry point
*@d_pointer: double pointer
* Return: void
*/
void _free_double_pointer(char **d_pointer)
{
unsigned int i = 0;
if (d_pointer == NULL)
return;
while (d_pointer[i])
{
free(d_pointer[i]);
++i;
}
if (d_pointer[i] == NULL)
free(d_pointer[i]);
free(d_pointer);
}
/**
* _free_parent - Entry point
*@buffer: pointer
*@commands: double pointer
* Return: void
*/
void _free_parent(char *buffer, char **commands)
{
free(buffer);
_free_double_pointer(commands);
}