aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-21 20:14:18 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-21 20:14:18 +0100
commit65313b6bc8aa66feeb5590a05e1b15099be1c7ff (patch)
treea3c65019c52fd3ed25e1f6ce5c966924c578bbf5
parentStarting to valgrind (diff)
download42-cub3d-65313b6bc8aa66feeb5590a05e1b15099be1c7ff.tar.gz
42-cub3d-65313b6bc8aa66feeb5590a05e1b15099be1c7ff.tar.bz2
42-cub3d-65313b6bc8aa66feeb5590a05e1b15099be1c7ff.tar.xz
42-cub3d-65313b6bc8aa66feeb5590a05e1b15099be1c7ff.tar.zst
42-cub3d-65313b6bc8aa66feeb5590a05e1b15099be1c7ff.zip
Freed leaks
Diffstat (limited to '')
-rw-r--r--src/ft_exit.c4
-rw-r--r--src/ft_init_map.c5
-rw-r--r--src/ft_warp_level.c6
3 files changed, 13 insertions, 2 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index b9e68d0..477a0ec 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -73,6 +73,10 @@ static void
ft_memdel((void*)&clist->sfx[1].cmd_alt);
ft_memdel((void*)&clist->sfx[3].cmd_alt);
ft_free_sprites(clist->mlist.sprite_path);
+ i = -1;
+ while (++i < 2)
+ ft_memdel((void*)&clist->weaps[i]);
+ ft_memdel((void*)&clist->weaps);
if (!clist->wlist.inited)
ft_memdel((void*)&clist->wlist.winptr);
}
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 717506c..a2a9ce1 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -68,8 +68,9 @@ int8_t
ft_bzero(mlist->sprite_order, 4096);
ft_bzero(mlist->traps_order, 512);
ft_bzero(mlist->heals_order, 64);
- ft_bzero(mlist->weaps_nbr, 2);
- ft_bzero(mlist->weaps_order, 2);
+ mlist->weaps_nbr[0] = 0;
+ mlist->weaps_nbr[1] = 0;
+ ft_bzero(mlist->weaps_order, 1);
return (0);
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 93c47a4..009e544 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -23,6 +23,8 @@
static void
ft_del_map(t_map *ml)
{
+ int8_t i;
+
ft_memdel((void*)&ml->filename);
ft_memdel((void*)&ml->no_tex_path);
ft_memdel((void*)&ml->so_tex_path);
@@ -39,6 +41,10 @@ static void
ft_memdel((void*)&ml->mapl);
ft_free_sprites(ml->sprite_path);
ft_free_words(ml->map);
+ i = -1;
+ while (++i < 2)
+ ft_memdel((void*)&clist->weaps[i]);
+ ft_memdel((void*)&clist->weaps);
}
static void