From abd20a73b4733a1a8b845f6ff0817ed77e545173 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 10 Mar 2020 10:48:58 +0100 Subject: Freed multiple leaks --- src/ft_save_to_bmp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ft_save_to_bmp.c') 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); } -- cgit v1.2.3