diff --git a/LEGO1/lego/sources/misc/legocontainer.cpp b/LEGO1/lego/sources/misc/legocontainer.cpp index 1b1189b0..558526dd 100644 --- a/LEGO1/lego/sources/misc/legocontainer.cpp +++ b/LEGO1/lego/sources/misc/legocontainer.cpp @@ -88,7 +88,7 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo) textureInfo->m_surface->Release(); textureInfo->m_palette->Release(); delete textureInfo; - textureInfo = NULL; + return NULL; } else { if (((TglImpl::RendererImpl*) VideoManager()->GetRenderer()) @@ -96,12 +96,14 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo) textureInfo->m_surface->Release(); textureInfo->m_palette->Release(); delete textureInfo; - textureInfo = NULL; + return NULL; } else { textureInfo->m_texture->SetAppData((DWORD) textureInfo); m_list.push_back(LegoTextureListElement(textureInfo, TRUE)); + textureInfo->m_texture->AddRef(); + if (textureInfo->m_name != NULL) { delete[] textureInfo->m_name; }