aboutsummaryrefslogtreecommitdiff
path: root/ft_lstclear_bonus.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-17 09:09:41 +0200
committerCharles <sircharlesaze@gmail.com>2019-10-17 09:09:41 +0200
commit6cb01d2fd8a6b07ef3ddaa8bb322f30c545316e7 (patch)
treeb4ff52e57f5cbef2a4ea578e0401a2b206318d4a /ft_lstclear_bonus.c
parent8a4d4c806e9896228f016baa62c5c7e219acf655 (diff)
downloadlibft-6cb01d2fd8a6b07ef3ddaa8bb322f30c545316e7.tar.gz
libft-6cb01d2fd8a6b07ef3ddaa8bb322f30c545316e7.tar.bz2
libft-6cb01d2fd8a6b07ef3ddaa8bb322f30c545316e7.zip
More protection
- substr if start > str length - all list functions check for NULL reference - not modifying const pointers
Diffstat (limited to 'ft_lstclear_bonus.c')
-rw-r--r--ft_lstclear_bonus.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ft_lstclear_bonus.c b/ft_lstclear_bonus.c
index b5829c7..ca80fb2 100644
--- a/ft_lstclear_bonus.c
+++ b/ft_lstclear_bonus.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/09 09:02:39 by cacharle #+# #+# */
-/* Updated: 2019/10/15 14:32:23 by cacharle ### ########.fr */
+/* Updated: 2019/10/17 09:03:58 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,9 +15,9 @@
void ft_lstclear(t_list **lst, void (*del)(void *))
{
- if (*lst == NULL)
+ if (*lst == NULL || lst == NULL || del == NULL)
return ;
- ft_lstclear(&(*lst)->next, del);
+ ft_lstclear(&((*lst)->next), del);
ft_lstdelone(*lst, del);
*lst = NULL;
}