add free on days 21 to 25, nothing leaks now (maybe)

This commit is contained in:
2024-12-29 23:54:34 +01:00
parent 27a62a50ad
commit fa519ac929
7 changed files with 158 additions and 14 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/17 23:03:36 by tomoron #+# #+# */
/* Updated: 2024/12/24 16:05:51 by tomoron ### ########.fr */
/* Updated: 2024/12/29 23:51:34 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -144,5 +144,12 @@ long int resolve_part1(char *input, char **split)
}
tmp = tmp->next;
}
while(vars)
{
tmp = vars->next;
free(vars->op);
free(vars);
vars = tmp;
}
return(res);
}

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/17 23:03:36 by tomoron #+# #+# */
/* Updated: 2024/12/24 18:44:00 by tomoron ### ########.fr */
/* Updated: 2024/12/29 23:51:59 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -254,6 +254,7 @@ long int resolve_part2(char *input, char **split)
{
(void)input;
t_vars *vars;
t_vars *tmp;
vars = 0;
while((*split)[3] == ':')
@ -269,5 +270,12 @@ long int resolve_part2(char *input, char **split)
// show_wrong(vars);
get_wrong(vars);
printf("order it yourself idgaf\n");
while(vars)
{
tmp = vars->next;
free(vars->op);
free(vars);
vars = tmp;
}
return(0);
}