free tous les mallocs
This commit is contained in:
13
philo/init.c
13
philo/init.c
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:30:34 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/31 10:20:25 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/02 00:18:04 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -114,17 +114,20 @@ t_philo *init(int ac, char **av, pthread_t **id)
|
||||
t_params *params;
|
||||
t_global *global;
|
||||
|
||||
philo = NULL;
|
||||
params = NULL;
|
||||
global = NULL;
|
||||
params = init_params(ac, av);
|
||||
if (params == NULL)
|
||||
return (NULL);
|
||||
global = init_global();
|
||||
if (params == NULL)
|
||||
return (NULL);
|
||||
if (global == NULL)
|
||||
return (return_free(params, NULL, NULL));
|
||||
*id = malloc(sizeof(pthread_t) * params->n_phi);
|
||||
if (*id == NULL)
|
||||
return (NULL);
|
||||
return (return_free(params, global, NULL));
|
||||
philo = init_chain_philo(params, global);
|
||||
if (philo == NULL)
|
||||
return (NULL);
|
||||
return (return_free(params, global, *id));
|
||||
return (philo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user