forked from josanri/Libft_extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_doublefree.c
33 lines (30 loc) · 1.19 KB
/
ft_doublefree.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_doublefree.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aalvarez <aalvarez@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/21 18:22:56 by aalvarez #+# #+# */
/* Updated: 2022/08/21 18:49:24 by aalvarez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
/**
* @brief attempts to free a double pointer pointed by str.
*
* @param str the double pointer to free.
* @return NULL.
*/
char **ft_doublefree(char **str)
{
int i;
if (str == NULL)
return (str);
i = -1;
while (str[++i])
free(str[i]);
free(str);
return (NULL);
}