diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-06 19:03:24 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-06 19:03:51 +0100 |
commit | a35b258841cde7884f5bb71d5ae0951d5e3f27b7 (patch) | |
tree | b7d1c6801ba924e129b3d008091a3f1b2e0adc95 /src/ft_parse_map.c | |
parent | Name is Cub3D anyway (diff) | |
download | 42-cub3d-a35b258841cde7884f5bb71d5ae0951d5e3f27b7.tar.gz 42-cub3d-a35b258841cde7884f5bb71d5ae0951d5e3f27b7.tar.bz2 42-cub3d-a35b258841cde7884f5bb71d5ae0951d5e3f27b7.tar.xz 42-cub3d-a35b258841cde7884f5bb71d5ae0951d5e3f27b7.tar.zst 42-cub3d-a35b258841cde7884f5bb71d5ae0951d5e3f27b7.zip |
fork(3) going well, freed a leak
Diffstat (limited to 'src/ft_parse_map.c')
-rw-r--r-- | src/ft_parse_map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 3c1fd9c..36d1ec5 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -75,13 +75,13 @@ static int8_t } void - ft_save_name(const char *map_path, t_map *mlist, t_cub *clist) + ft_save_name(const char *map_path, t_cub *clist) { - ft_memdel((void**)&mlist->filename); - if (!(mlist->filename = + ft_memdel((void**)&clist->mlist.filename); + if (!(clist->mlist.filename = (char*)malloc((ft_strlen(map_path) + 1) * sizeof(char)))) ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist); - ft_sprintf(mlist->filename, "%s", map_path); + ft_sprintf(clist->mlist.filename, "%s", map_path); } void @@ -95,7 +95,7 @@ void fd = open(map_path, O_RDONLY); if (fd < 0) ft_error(FT_RET_NO_MAP, FT_ERR_NO_MAP, clist); - ft_save_name(map_path, &clist->mlist, clist); + ft_save_name(map_path, clist); ret = 1; while (ret != 12 && ret >= 0) ret = ft_parse_it(fd, clist); |