-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfree.c
More file actions
39 lines (35 loc) · 732 Bytes
/
Copy pathfree.c
File metadata and controls
39 lines (35 loc) · 732 Bytes
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
#include "holberton.h"
/**
* free_all - frees all malloc'd space at end of main loop
* @tokens: pointer to tokens array
* @path: pointer to path variable
* @line: pointer to user input buffer
* @fullpath: pointer to full path
* @flag: flag marking if full_path was malloc'd
* Return: void
*/
void free_all(char **tokens, char *path, char *line, char *fullpath, int flag)
{
free(path);
free(tokens);
free(line);
if (flag == 1)
free(fullpath);
}
/**
* free_dp - free double pointer
* @array: double pointer to free
* @length: length of double pointer
* Return: void
*/
void free_dp(char **array, unsigned int length)
{
unsigned int i;
i = 0;
while (i < length)
{
free(array[i]);
i++;
}
free(array);
}