From 3a82896da42523d74e468d75c58d99624916e1b7 Mon Sep 17 00:00:00 2001 From: julianjany <54538266+julianjany@users.noreply.github.com> Date: Fri, 23 Sep 2022 16:29:15 +0200 Subject: [PATCH] Update Image.cpp I seem to have found a memory-leak that occurs when an image is loaded from disk. --- Walnut/src/Walnut/Image.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Walnut/src/Walnut/Image.cpp b/Walnut/src/Walnut/Image.cpp index d1fc3166..c3b51b92 100644 --- a/Walnut/src/Walnut/Image.cpp +++ b/Walnut/src/Walnut/Image.cpp @@ -69,6 +69,7 @@ namespace Walnut { AllocateMemory(m_Width * m_Height * Utils::BytesPerPixel(m_Format)); SetData(data); + stbi_image_free(data); } Image::Image(uint32_t width, uint32_t height, ImageFormat format, const void* data) @@ -287,4 +288,4 @@ namespace Walnut { AllocateMemory(m_Width * m_Height * Utils::BytesPerPixel(m_Format)); } -} \ No newline at end of file +}