diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-10 10:48:58 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-10 10:48:58 +0100 |
commit | abd20a73b4733a1a8b845f6ff0817ed77e545173 (patch) | |
tree | 24e9630c1895c7ba17b0cff8b4061a0cab2cf46f /src/ft_save_to_bmp.c | |
parent | ok now (diff) | |
download | 42-cub3d-abd20a73b4733a1a8b845f6ff0817ed77e545173.tar.gz 42-cub3d-abd20a73b4733a1a8b845f6ff0817ed77e545173.tar.bz2 42-cub3d-abd20a73b4733a1a8b845f6ff0817ed77e545173.tar.xz 42-cub3d-abd20a73b4733a1a8b845f6ff0817ed77e545173.tar.zst 42-cub3d-abd20a73b4733a1a8b845f6ff0817ed77e545173.zip |
Freed multiple leaks
Diffstat (limited to 'src/ft_save_to_bmp.c')
-rw-r--r-- | src/ft_save_to_bmp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c index 90bbb1f..ae3a2b6 100644 --- a/src/ft_save_to_bmp.c +++ b/src/ft_save_to_bmp.c @@ -93,9 +93,10 @@ static int8_t bmp_info.size_image = size; if (!(fd = open(fname, O_RDWR | O_CREAT, 0644))) return (-1); - write(fd, &bmp_file, sizeof(t_bmp_file)); - write(fd, &bmp_info, sizeof(t_bmp_info)); - write(fd, bmp, size); + if (!write(fd, &bmp_file, sizeof(t_bmp_file)) || + !write(fd, &bmp_info, sizeof(t_bmp_info)) || + !write(fd, bmp, size)) + return (-1); close(fd); return (0); } |