ft_free2.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* ft_free2.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: ll-hotel <ll-hotel@student.42.fr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2024/10/16 17:38:17 by ll-hotel #+# #+# */ 9 /* Updated: 2024/10/20 15:42:38 by ll-hotel ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include <stdlib.h> 14 15 void *ft_free2(void **p, void (*_free)(void *)) 16 { 17 int i; 18 19 if (!p) 20 return (NULL); 21 i = 0; 22 while (p[i] != NULL) 23 _free(p[i++]); 24 free(p); 25 return (NULL); 26 }