Skip to content

Commit

Permalink
Fixed stbi image data not being freed
Browse files Browse the repository at this point in the history
Fixes memory leak in Image.cpp
  • Loading branch information
TheCherno authored Jan 24, 2023
2 parents 20f940b + 3a82896 commit 62d8ffa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Walnut/src/Walnut/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -287,4 +288,4 @@ namespace Walnut {
AllocateMemory(m_Width * m_Height * Utils::BytesPerPixel(m_Format));
}

}
}

0 comments on commit 62d8ffa

Please sign in to comment.