aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-01-27 19:25:52 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-01-27 19:25:52 +0100
commitc17573ee9702dec04c22800564e72ece76ab386b (patch)
tree11efa8a5484ca82e84223c75de7e23a1fbf6d202 /src/ft_get_map.c
parentSwitched lists entierly (diff)
download42-cub3d-c17573ee9702dec04c22800564e72ece76ab386b.tar.gz
42-cub3d-c17573ee9702dec04c22800564e72ece76ab386b.tar.bz2
42-cub3d-c17573ee9702dec04c22800564e72ece76ab386b.tar.xz
42-cub3d-c17573ee9702dec04c22800564e72ece76ab386b.tar.zst
42-cub3d-c17573ee9702dec04c22800564e72ece76ab386b.zip
Not normed but ok
Diffstat (limited to 'src/ft_get_map.c')
-rw-r--r--src/ft_get_map.c7
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);