diff options
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r-- | src/ft_exit.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c index b2ccd69..d135433 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -21,10 +21,23 @@ #include <stdint.h> static void - ft_free_lists(t_cub *clist) +ft_free_some_extras(t_cub *clist) { uint8_t i; + i = 0; + while (i < 8) + { + ft_memdel((void**)&clist->sprites[i]); + i++; + } + ft_memdel((void**)&clist->sprites); + ft_memdel((void**)&clist); +} + +static void + ft_free_lists(t_cub *clist) +{ ft_memdel((void**)&clist->mlist.filename); ft_memdel((void**)&clist->mlist.no_tex_path); ft_memdel((void**)&clist->mlist.so_tex_path); @@ -49,14 +62,6 @@ static void ft_free_sprites(clist->mlist.sprite_path); if (!clist->wlist.inited) ft_memdel((void**)&clist->wlist.winptr); - i = 0; - while (i < 8) - { - ft_memdel((void**)clist->sprites[i]); - i++; - } - ft_memdel((void**)&clist->sprites); - ft_memdel((void**)&clist); } static void @@ -119,6 +124,7 @@ int } ft_kill_forks(clist); ft_free_lists(clist); + ft_free_some_extras(clist); ft_printf("Exiting program\n"); exit(exit_code); return (0); |