aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-01-24 17:57:20 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-01-24 17:57:20 +0100
commit6776a1f3491663c85480326e0d01f9a6c5455bbd (patch)
tree035435a20e933c43b192552a5b3f766fe55131e5 /src/ft_exit.c
parentft_split redone (diff)
download42-cub3d-6776a1f3491663c85480326e0d01f9a6c5455bbd.tar.gz
42-cub3d-6776a1f3491663c85480326e0d01f9a6c5455bbd.tar.bz2
42-cub3d-6776a1f3491663c85480326e0d01f9a6c5455bbd.tar.xz
42-cub3d-6776a1f3491663c85480326e0d01f9a6c5455bbd.tar.zst
42-cub3d-6776a1f3491663c85480326e0d01f9a6c5455bbd.zip
Tons of changes
Diffstat (limited to '')
-rw-r--r--src/ft_exit.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 5a4ef73..165c3d9 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -1,13 +1,29 @@
#include <libft.h>
+#include <cub3d.h>
#include <stdlib.h>
#include <inttypes.h>
+static void
+ft_free_lists(t_win *wlist)
+{
+ ft_memdel(wlist->clist->no_tex_path);
+ ft_memdel(wlist->clist->so_tex_path);
+ ft_memdel(wlist->clist->ea_tex_path);
+ ft_memdel(wlist->clist->we_tex_path);
+ ft_memdel(wlist->clist->sprite_path);
+ ft_memdel(wlist->clist);
+ ft_memdel(wlist->winptr);
+ ft_memdel(wlist->wlx);
+ ft_memdel(wlist);
+}
+
int
-ft_exit(uint8_t exit_code)
+ft_exit(uint8_t exit_code, t_win *wlist)
{
ft_printf("Exiting program\n");
if (exit_code < 0 || exit_code > 0)
ft_printf("Exit code: %hhu\n", exit_code);
+ ft_free_lists(wlist);
exit(exit_code);
return (0);
}