aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-07 13:58:21 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-07 13:58:21 +0200
commit9ec1dcddc92571ba7b65710f49ffc0d018c6db71 (patch)
treec4d3358e45b2d621a5e1e942291e41d17af9509f /src
parentBetter sound handling, few changes (diff)
download42-cub3d-9ec1dcddc92571ba7b65710f49ffc0d018c6db71.tar.gz
42-cub3d-9ec1dcddc92571ba7b65710f49ffc0d018c6db71.tar.bz2
42-cub3d-9ec1dcddc92571ba7b65710f49ffc0d018c6db71.tar.xz
42-cub3d-9ec1dcddc92571ba7b65710f49ffc0d018c6db71.tar.zst
42-cub3d-9ec1dcddc92571ba7b65710f49ffc0d018c6db71.zip
Freed big leaks
Diffstat (limited to 'src')
-rw-r--r--src/ft_del_sfx_cmd.c2
-rw-r--r--src/ft_del_sprites_lists.c3
-rw-r--r--src/ft_exit.c19
-rw-r--r--src/ft_warp_level.c2
4 files changed, 19 insertions, 7 deletions
diff --git a/src/ft_del_sfx_cmd.c b/src/ft_del_sfx_cmd.c
index 9d33eb9..fdfdacd 100644
--- a/src/ft_del_sfx_cmd.c
+++ b/src/ft_del_sfx_cmd.c
@@ -20,7 +20,7 @@ void
uint8_t i;
i = 0;
- while (i < 16)
+ while (i < FT_TOTAL_SFX)
{
ft_memdel((void*)&clist->sfx[i].cmd);
i++;
diff --git a/src/ft_del_sprites_lists.c b/src/ft_del_sprites_lists.c
index b7a854d..2b37c26 100644
--- a/src/ft_del_sprites_lists.c
+++ b/src/ft_del_sprites_lists.c
@@ -19,7 +19,8 @@ void
{
int8_t i;
- ft_memdel((void*)&clist->bad_boy);
+ if (clist->mlist.sprite_nbr[13] > 0)
+ ft_memdel((void*)&clist->bad_boy);
i = 0;
while (i < FT_TOTAL_SPRT)
{
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 6d93f8e..4f2494b 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
+#include <signal.h>
static void
ft_del_last_remains(t_cub *clist)
@@ -45,15 +46,25 @@ static void
if (clist->isoldmus && clist->wlist.inited)
{
- pthread_cancel(clist->mtid);
- pthread_join(clist->mtid, NULL);
+ if (FT_OS == 2)
+ {
+ pthread_cancel(clist->mtid);
+ pthread_join(clist->mtid, NULL);
+ }
+ else
+ system(FT_SND_TERM_CMD);
}
i = -1;
while (++i < FT_TOTAL_SFX)
{
pthread_mutex_unlock(&clist->sfx[i].mutex);
- pthread_cancel(clist->sfx[i].tid);
- pthread_join(clist->sfx[i].tid, NULL);
+ if (FT_OS == 2)
+ {
+ pthread_cancel(clist->sfx[i].tid);
+ pthread_join(clist->sfx[i].tid, NULL);
+ }
+ else
+ system(FT_SND_TERM_CMD);
}
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index f9fac3e..bc56433 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -56,6 +56,7 @@ static int8_t
cl->c_rgb = ft_init_rgb();
cl->rlist = ft_init_s_ray();
ft_del_tex(cl);
+ cl->walltexgood = 0;
ft_del_map(&cl->mlist);
ft_del_sprites_lists(cl);
if (ft_init_sprites(&cl->sprites) < 0)
@@ -99,7 +100,6 @@ int8_t
char *tmp_mup;
uint8_t isoldmus;
- cl->walltexgood = 0;
if (!(next_path = (char *)malloc((ft_strlen(path) + 1) * sizeof(char))))
return (-1);
ft_sprintf(next_path, "%s", path);