aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_weap_init.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 14:00:59 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 14:00:59 +0100
commit1bd6b6e64b02ce70e193bb108843bc0ee5c051c3 (patch)
tree394788b4dc6f1248f44894798fc708e87f1bd8a1 /src/ft_tex_weap_init.c
parentLoaded weapon images needs to memory (diff)
download42-cub3d-1bd6b6e64b02ce70e193bb108843bc0ee5c051c3.tar.gz
42-cub3d-1bd6b6e64b02ce70e193bb108843bc0ee5c051c3.tar.bz2
42-cub3d-1bd6b6e64b02ce70e193bb108843bc0ee5c051c3.tar.xz
42-cub3d-1bd6b6e64b02ce70e193bb108843bc0ee5c051c3.tar.zst
42-cub3d-1bd6b6e64b02ce70e193bb108843bc0ee5c051c3.zip
Correct init and frees
Diffstat (limited to '')
-rw-r--r--src/ft_tex_weap_init.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ft_tex_weap_init.c b/src/ft_tex_weap_init.c
index ac78de9..b17255a 100644
--- a/src/ft_tex_weap_init.c
+++ b/src/ft_tex_weap_init.c
@@ -43,4 +43,12 @@ void
FT_WEAPON_TWO_FIRE_PATH, &cl->tweap[3].img_w, &cl->tweap[3].img_h);
cl->tweap[3].ptr = mlx_get_data_addr(cl->tweap[3].img,
&cl->tweap[3].bpp, &cl->tweap[3].sizeline, &cl->tweap[3].endian);
+ if (cl->tweap[0].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tweap[0].img);
+ if (cl->tweap[1].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tweap[1].img);
+ if (cl->tweap[2].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tweap[2].img);
+ if (cl->tweap[3].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tweap[3].img);
}