Skip to content

Commit

Permalink
add some check for free all philo
Browse files Browse the repository at this point in the history
  • Loading branch information
aabda96 committed Feb 15, 2023
1 parent d679a96 commit e6b8ed5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions srcs/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: aabda <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/13 18:32:59 by aabda #+# #+# */
/* Updated: 2023/02/15 14:16:47 by aabda ### ########.fr */
/* Updated: 2023/02/15 17:26:23 by aabda ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -47,10 +47,15 @@ void ft_free_philo(t_global *g)
t_philo *tmp;
int i;

tmp = g->philo;
if (g->philo)
tmp = g->philo;
else
tmp = NULL;
i = -1;
while (++i < g->params.nbr_philo)
{
if (!g->philo || !tmp)
break ;
g->philo = tmp;
tmp = g->philo->next;
if (g->philo->fork)
Expand Down

0 comments on commit e6b8ed5

Please sign in to comment.