diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 19:42:48 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 19:42:48 +0100 |
commit | 75f54cd49e5b9942678d2b8a8137ca1110a785f5 (patch) | |
tree | 9abbe2b12a0d1cc016bc3bfa5ce95f15d6cd625d /src/main.c | |
parent | Revert (diff) | |
download | 42-cub3d-75f54cd49e5b9942678d2b8a8137ca1110a785f5.tar.gz 42-cub3d-75f54cd49e5b9942678d2b8a8137ca1110a785f5.tar.bz2 42-cub3d-75f54cd49e5b9942678d2b8a8137ca1110a785f5.tar.xz 42-cub3d-75f54cd49e5b9942678d2b8a8137ca1110a785f5.tar.zst 42-cub3d-75f54cd49e5b9942678d2b8a8137ca1110a785f5.zip |
Valgrind errors fix
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -17,16 +17,18 @@ int main(int argc, const char *argv[], char *const envp[]) { - t_cub clist; + t_cub *clist; if (ft_check_map_arg(argc, argv) == FT_RET_BAD_ARGV) return (FT_RET_BAD_ARGV); - if (ft_init_cub3d(&clist) < 0) + if (!(clist = (t_cub*)malloc(sizeof(t_cub)))) + return (FT_RET_ALLOC_ERR); + if (ft_init_cub3d(clist) < 0) return (FT_RET_FAILED_STRUCTS); - ft_parse_map(argv[1], &clist); - if (ft_init_winlx(&clist) < 0) - return (ft_exit(FT_RET_FAILED_MLX, &clist)); - ft_wall_tex_init(&clist); - ft_use_args(argc, argv, envp, &clist); + ft_parse_map(argv[1], clist); + if (ft_init_winlx(clist) < 0) + return (ft_exit(FT_RET_FAILED_MLX, clist)); + ft_wall_tex_init(clist); + ft_use_args(argc, argv, envp, clist); return (FT_RET_FINE); } |