diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-01-24 18:52:32 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-01-24 18:52:32 +0100 |
commit | 0e55e163397f2b109321ad284d298e60ee3b97a7 (patch) | |
tree | f30aacccaefc5c063a2a6840f02d2e02bdef6b90 /src/ft_get_res.c | |
parent | Correct (diff) | |
download | 42-cub3d-0e55e163397f2b109321ad284d298e60ee3b97a7.tar.gz 42-cub3d-0e55e163397f2b109321ad284d298e60ee3b97a7.tar.bz2 42-cub3d-0e55e163397f2b109321ad284d298e60ee3b97a7.tar.xz 42-cub3d-0e55e163397f2b109321ad284d298e60ee3b97a7.tar.zst 42-cub3d-0e55e163397f2b109321ad284d298e60ee3b97a7.zip |
cleaner frees
Diffstat (limited to 'src/ft_get_res.c')
-rw-r--r-- | src/ft_get_res.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ft_get_res.c b/src/ft_get_res.c index 79df8a3..8cf1809 100644 --- a/src/ft_get_res.c +++ b/src/ft_get_res.c @@ -21,15 +21,20 @@ ft_get_res(int fd, t_win *wlist) get_next_line(fd, &line); if (!(words = ft_split(line, ' '))) + { + ft_memdel(line); return (ft_exit(5, wlist)); + } if (!(*words) || ft_strcmp(*words, "R") || !(*(words + 1)) || !(*(words + 2)) || (*(words + 3))) + { + ft_free_words(words, line); return (ft_map_error(1, wlist)); + } ft_checkdigit(words[1], wlist); ft_checkdigit(words[2], wlist); wlist->x_size = ft_atoi(words[1]); wlist->y_size = ft_atoi(words[2]); - ft_free_words(words); - ft_memdel(line); + ft_free_words(words, line); return (0); } |