From cccef2b089c0791f423a2f0df2fca8f4fb988a09 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sun, 26 Jan 2020 23:54:20 +0000 Subject: [PATCH] Fix memory leaks --- src/Draw.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Draw.cpp b/src/Draw.cpp index 5b5c59f7..aeb680bc 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -294,6 +294,8 @@ BOOL MakeSurface_File(const char *name, SurfaceID surf_no) int width, height; unsigned char *image_buffer = DecodeBitmap(data, size, &width, &height); + free(data); + if (image_buffer == NULL) { PrintBitmapError(path, 1); @@ -388,6 +390,8 @@ BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no) int width, height; unsigned char *image_buffer = DecodeBitmap(data, size, &width, &height); + free(data); + if (image_buffer == NULL) { PrintBitmapError(path, 1);