version sans erreurs de valgrind autre que trois leaks

This commit is contained in:
Hugo LAMY
2019-06-01 13:47:21 +02:00
parent 04a4fef38b
commit 56ca478503
5 changed files with 43 additions and 6 deletions

21
main.c
View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
/* Updated: 2019/05/29 13:27:14 by vmanzoni ### ########.fr */
/* Updated: 2019/06/01 13:41:46 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -66,6 +66,22 @@ int is_mdp(int ac, char **av)
return (1);
}
/*
** Function that free the list
*/
void clean_list(t_fillist *list, t_fillist *tmp)
{
tmp = list;
while (list)
{
list = tmp->next;
free(tmp->memory);
free(tmp);
tmp = list;
}
}
/*
** Main function
*/
@@ -87,8 +103,11 @@ int main(int ac, char **av)
check_file_errors(input, dope);
size = parse_input(input, &list, dope);
print_final_map(list, size);
free(input);
clean_list(list, list);
}
else
print_error("usage: Please submit a file.\n> ./fillit file.fillit\n");
free(dope);
return (0);
}