diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-29 22:49:10 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-29 22:49:10 +0100 |
commit | 46538b419624d27d590d981d070b387291e1abc8 (patch) | |
tree | 234b58813339bd10a97f06dd96cf0984d384a0b3 /src | |
parent | Debug flags is native (diff) | |
download | 42-cub3d-46538b419624d27d590d981d070b387291e1abc8.tar.gz 42-cub3d-46538b419624d27d590d981d070b387291e1abc8.tar.bz2 42-cub3d-46538b419624d27d590d981d070b387291e1abc8.tar.xz 42-cub3d-46538b419624d27d590d981d070b387291e1abc8.tar.zst 42-cub3d-46538b419624d27d590d981d070b387291e1abc8.zip |
No leak
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_exit.c | 5 | ||||
-rw-r--r-- | src/ft_init_lists.c | 1 | ||||
-rw-r--r-- | src/ft_tex_init.c | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c index 4914803..b2efe2f 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -41,7 +41,7 @@ static void int ft_exit(uint8_t exit_code, t_cub *clist) { - if (clist->wlist->inited) + if (clist->walltexgood) { if (clist->tlist[0].img) mlx_destroy_image(clist->wlist->wlx, clist->tlist[0].img); @@ -55,8 +55,9 @@ int mlx_destroy_image(clist->wlist->wlx, clist->tlist[4].img); if (clist->mlist->isnlvl && clist->tlist[5].img) mlx_destroy_image(clist->wlist->wlx, clist->tlist[5].img); - mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); } + if (clist->wlist->inited) + mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); ft_free_lists(clist); ft_printf("Exiting program\n"); exit(exit_code); diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index f451220..055fd98 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -86,6 +86,7 @@ static t_cub clist->c_rgb = ft_init_rgb(); clist->rlist = ft_init_s_ray(); clist->currlvl = 0; + clist->walltexgood = 0; clist->key_ptr[0] = ft_w_key; clist->key_ptr[1] = ft_a_key; clist->key_ptr[2] = ft_s_key; diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index 0e5cb69..6e12a56 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -58,4 +58,5 @@ void &cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian); if (cl->mlist->isnlvl) ft_get_nlvl_img(cl); + cl->walltexgood = 1; } |