mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix memory leak detected by address sanitizer (#10896)
This commit is contained in:
parent
f227e40180
commit
2072afb72b
@ -153,7 +153,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
|
|||||||
RenderingEngine::~RenderingEngine()
|
RenderingEngine::~RenderingEngine()
|
||||||
{
|
{
|
||||||
core.reset();
|
core.reset();
|
||||||
m_device->drop();
|
m_device->closeDevice();
|
||||||
s_singleton = nullptr;
|
s_singleton = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,6 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
|
|||||||
if (name.empty())
|
if (name.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
m_to_delete.insert(name);
|
|
||||||
|
|
||||||
#if ENABLE_GLES
|
#if ENABLE_GLES
|
||||||
video::ITexture *retval = m_driver->findTexture(name.c_str());
|
video::ITexture *retval = m_driver->findTexture(name.c_str());
|
||||||
if (retval)
|
if (retval)
|
||||||
@ -88,6 +86,7 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
|
|||||||
|
|
||||||
image = Align2Npot2(image, m_driver);
|
image = Align2Npot2(image, m_driver);
|
||||||
retval = m_driver->addTexture(name.c_str(), image);
|
retval = m_driver->addTexture(name.c_str(), image);
|
||||||
|
m_to_delete.insert(name);
|
||||||
image->drop();
|
image->drop();
|
||||||
return retval;
|
return retval;
|
||||||
#else
|
#else
|
||||||
|
@ -378,6 +378,7 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store our face.
|
// Store our face.
|
||||||
|
sguitt_face = face;
|
||||||
tt_face = face->face;
|
tt_face = face->face;
|
||||||
|
|
||||||
// Store font metrics.
|
// Store font metrics.
|
||||||
@ -436,6 +437,9 @@ CGUITTFont::~CGUITTFont()
|
|||||||
// Drop our driver now.
|
// Drop our driver now.
|
||||||
if (Driver)
|
if (Driver)
|
||||||
Driver->drop();
|
Driver->drop();
|
||||||
|
|
||||||
|
// Destroy sguitt_face after clearing c_faces
|
||||||
|
delete sguitt_face;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGUITTFont::reset_images()
|
void CGUITTFont::reset_images()
|
||||||
|
@ -375,6 +375,7 @@ namespace gui
|
|||||||
gui::IGUIEnvironment* Environment;
|
gui::IGUIEnvironment* Environment;
|
||||||
video::IVideoDriver* Driver;
|
video::IVideoDriver* Driver;
|
||||||
io::path filename;
|
io::path filename;
|
||||||
|
SGUITTFace* sguitt_face = nullptr;
|
||||||
FT_Face tt_face;
|
FT_Face tt_face;
|
||||||
FT_Size_Metrics font_metrics;
|
FT_Size_Metrics font_metrics;
|
||||||
FT_Int32 load_flags;
|
FT_Int32 load_flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user