fix memory leak during export

pull/2885/head
kimkulling 2020-03-25 16:37:43 +01:00
parent 6f8d96b57e
commit ccd13436da
2 changed files with 94 additions and 88 deletions

View File

@ -312,7 +312,9 @@ void ExportSceneM3DA(
M3DExporter::M3DExporter(const aiScene *pScene, const ExportProperties *pProperties) :
mScene(pScene),
mProperties(pProperties),
outfile() {}
outfile() {
// empty
}
// ------------------------------------------------------------------------------------------------
void M3DExporter::doExport(
@ -352,6 +354,9 @@ void M3DExporter::doExport(
// explicitly release file pointer,
// so we don't have to rely on class destruction.
outfile.reset();
M3D_FREE(m3d->name);
m3d->name = nullptr;
}
// ------------------------------------------------------------------------------------------------

View File

@ -121,8 +121,9 @@ M3DWrapper::~M3DWrapper() {
void M3DWrapper::reset() {
ClearSave();
if (m3d_)
if (m3d_) {
m3d_free(m3d_);
}
m3d_ = nullptr;
}