diff options
-rw-r--r-- | src/ft_get_map.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c index e41ffd6..a57e32e 100644 --- a/src/ft_get_map.c +++ b/src/ft_get_map.c @@ -76,7 +76,12 @@ ft_get_map(int fd, t_cub *clist) while (ret > 0) { ret = get_next_line(fd, &line); - ft_check_err(line, len); + if (ft_check_err(line, len) < 0) + { + ft_memdel(line); + ft_memdel(mapl); + return (-1); + } mapl = (char*)ft_nrealloc(mapl, (((len / 2) + 2) * i) * sizeof(char), ((((len / 2) + 2) * i) + (ft_strlen(line) / 2) + 2) * sizeof(char)); ft_linecpy(line, mapl, ((len / 2) + 2) * i); |