-
Notifications
You must be signed in to change notification settings - Fork 12
/
ft_split_free.c
36 lines (32 loc) · 1.28 KB
/
ft_split_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split_free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/11/04 16:15:44 by apuchill #+# #+# */
/* Updated: 2021/02/07 09:27:09 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
/*
** LIBRARY: N/A
** SYNOPSIS: free ft_split() return pointer
**
** DESCRIPTION:
** The ft_split_free() function frees the memory space pointed to by s,
** which must have been returned by a previous call to malloc() by the
** ft_split() function.
*/
#include "libft.h"
void ft_split_free(char **s)
{
size_t i;
if (!s || !*s)
return ;
i = 0;
while (i < ft_strlen_2(s))
free(s[i++]);
free(s);
*s = NULL;
}