diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_exit.c | 24 | ||||
-rw-r--r-- | src/ft_init_map.c | 4 |
2 files changed, 17 insertions, 11 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); diff --git a/src/ft_init_map.c b/src/ft_init_map.c index 813a795..4fcff7e 100644 --- a/src/ft_init_map.c +++ b/src/ft_init_map.c @@ -42,7 +42,7 @@ static int8_t } static int8_t - ft_calloc_sprites(t_map *mlist) + ft_calloc_sprites_path(t_map *mlist) { uint8_t i; @@ -76,7 +76,7 @@ int8_t return (-1); mlist->map[1] = 0; mlist->mcmd_words[1] = 0; - if (ft_calloc_sprites(mlist) < 0) + if (ft_calloc_sprites_path(mlist) < 0) return (-1); mlist->map_w = 0; mlist->map_h = 0; |