Skip to content

Commit b5e109a

Browse files
committed
Added extra free that migh've caused memory leaks
1 parent 51eeba3 commit b5e109a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Source/Entities/SceneLayer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ int SceneLayerImpl<TRACK_DRAWINGS, STATIC_TEXTURE>::LoadDataFromBitmap(BITMAP* b
220220

221221
template <bool TRACK_DRAWINGS, bool STATIC_TEXTURE>
222222
int SceneLayerImpl<TRACK_DRAWINGS, STATIC_TEXTURE>::LoadData() {
223+
if (m_MainBitmapOwned) {
224+
destroy_bitmap(m_MainBitmap);
225+
}
226+
223227
// Load from disk and take ownership. Don't cache because the bitmap will be modified.
224228
m_MainBitmap = m_BitmapFile.GetAsBitmap(COLORCONV_NONE, false);
225229
m_MainBitmapOwned = true;

0 commit comments

Comments
 (0)