mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
fix: free map when parsing fails
https://www.notion.so/Leak-quand-fichier-n-est-pas-cub-233551de06f480d69d6cc79fa0a1837a?v=233551de06f480718417000cf26e3225&source=copy_link
This commit is contained in:
parent
c5f15dbf11
commit
2c7eef8f6c
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/17 14:14:30 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);
|
data.map = ft_calloc(sizeof(t_mapdata), 1);
|
||||||
if (!check_cubfile(argv[1], data.map))
|
if (!check_cubfile(argv[1], data.map))
|
||||||
return (ft_printf("Error: Wrong map file. Reason: %s\n",
|
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();
|
data.mlx = mlx_init();
|
||||||
if (data.mlx == NULL)
|
if (data.mlx == NULL)
|
||||||
return (ft_printf("Error: Failed to initalize mlx\n"),
|
return (ft_printf("Error: Failed to initalize mlx\n"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue