aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_res.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_get_res.c')
-rw-r--r--src/ft_get_res.c9
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);
}