From b388bc56a80e0733aba5bc6b83d3a4abc51a6147 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 10 Feb 2018 17:35:55 +0100 Subject: [PATCH] Load_INFO() fix memory leak --- src/fileformats.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fileformats.c b/src/fileformats.c index 70d3789f..63784954 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -2751,10 +2751,14 @@ void Load_INFO(T_IO_Context * context) } for (y_pos = 0; y_pos < imgheaders[img_count].Height; y_pos++) Draw_IFF_line(context, buffers[img_count] + y_pos * line_size, y_pos, plane_line_size << 3, imgheaders[img_count].Depth); + } + } + for (img_count = 0; img_count < 2; img_count++) + if (buffers[img_count] != NULL) + { free(buffers[img_count]); buffers[img_count] = NULL; } - } } else File_error=1;