fix(setters): added a tiny bit of security when freeing data

This commit is contained in:
Theo Champion 2025-07-22 12:57:39 +02:00 committed by Khaïs COLIN
parent 7449450c52
commit a67010b929

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 13:59:27 by kcolin #+# #+# */ /* Created: 2025/07/17 13:59:27 by kcolin #+# #+# */
/* Updated: 2025/07/17 15:55:22 by kcolin ### ########.fr */ /* Updated: 2025/07/22 12:54:01 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -48,12 +48,19 @@ void free_tab_length(char **tab, int length)
void free_map(t_mapdata *map) void free_map(t_mapdata *map)
{ {
if (map->map)
free_tab(map->map); free_tab(map->map);
if (map->mapflood)
free_tab(map->mapflood); free_tab(map->mapflood);
if (map->ea_texture)
free(map->ea_texture); free(map->ea_texture);
if (map->no_texture)
free(map->no_texture); free(map->no_texture);
if (map->so_texture)
free(map->so_texture); free(map->so_texture);
if (map->we_texture)
free(map->we_texture); free(map->we_texture);
if (map->filename)
free(map->filename); free(map->filename);
free(map); free(map);
} }