leaks are no more (for real this time)

This commit is contained in:
mdev9
2024-04-19 18:53:19 +02:00
parent a95e4bcbff
commit af73eddc64
3 changed files with 31 additions and 6 deletions

View File

@ -6,18 +6,38 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:19:26 by marde-vr #+# #+# */
/* Updated: 2024/04/18 20:49:01 by marde-vr ### ########.fr */
/* Updated: 2024/04/19 18:52:13 by marde-vr ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void free_fds(t_msh *msh)
{
int i;
if (msh->fds)
{
i = 0;
while (msh->fds[i])
{
free(msh->fds[i]);
msh->fds[i] = 0;
i++;
}
free(msh->fds);
msh->fds = 0;
}
}
void free_msh(t_msh *msh)
{
if (msh)
{
free_env(msh->env);
free(msh->pids);
free_cmd(msh->cmds_head);
free_fds(msh);
free_token(msh->tokens);
set_echoctl(msh->echoctl);
free(msh);