From 2c7eef8f6c0c80baa111c3beb0b54877bff78db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Mon, 21 Jul 2025 11:50:30 +0200 Subject: [PATCH] fix: free map when parsing fails https://www.notion.so/Leak-quand-fichier-n-est-pas-cub-233551de06f480d69d6cc79fa0a1837a?v=233551de06f480718417000cf26e3225&source=copy_link --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 9c60184..dd73434 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ -/* Updated: 2025/07/21 11:42:12 by kcolin ### ########.fr */ +/* Updated: 2025/07/21 11:50:30 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,7 +52,7 @@ int main(int argc, char **argv) data.map = ft_calloc(sizeof(t_mapdata), 1); if (!check_cubfile(argv[1], data.map)) return (ft_printf("Error: Wrong map file. Reason: %s\n", - data.map->error), 1); + data.map->error), free_map(data.map), 1); data.mlx = mlx_init(); if (data.mlx == NULL) return (ft_printf("Error: Failed to initalize mlx\n"),