fix memory leak during export
parent
6f8d96b57e
commit
ccd13436da
|
@ -292,8 +292,8 @@ void ExportSceneM3D(
|
||||||
// Prototyped and registered in Exporter.cpp
|
// Prototyped and registered in Exporter.cpp
|
||||||
void ExportSceneM3DA(
|
void ExportSceneM3DA(
|
||||||
const char *,
|
const char *,
|
||||||
IOSystem*,
|
IOSystem *,
|
||||||
const aiScene*,
|
const aiScene *,
|
||||||
const ExportProperties *
|
const ExportProperties *
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
@ -312,7 +312,9 @@ void ExportSceneM3DA(
|
||||||
M3DExporter::M3DExporter(const aiScene *pScene, const ExportProperties *pProperties) :
|
M3DExporter::M3DExporter(const aiScene *pScene, const ExportProperties *pProperties) :
|
||||||
mScene(pScene),
|
mScene(pScene),
|
||||||
mProperties(pProperties),
|
mProperties(pProperties),
|
||||||
outfile() {}
|
outfile() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void M3DExporter::doExport(
|
void M3DExporter::doExport(
|
||||||
|
@ -352,6 +354,9 @@ void M3DExporter::doExport(
|
||||||
// explicitly release file pointer,
|
// explicitly release file pointer,
|
||||||
// so we don't have to rely on class destruction.
|
// so we don't have to rely on class destruction.
|
||||||
outfile.reset();
|
outfile.reset();
|
||||||
|
|
||||||
|
M3D_FREE(m3d->name);
|
||||||
|
m3d->name = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -50,15 +50,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#ifdef ASSIMP_USE_M3D_READFILECB
|
#ifdef ASSIMP_USE_M3D_READFILECB
|
||||||
|
|
||||||
# if (__cplusplus >= 201103L) || !defined(_MSC_VER) || (_MSC_VER >= 1900) // C++11 and MSVC 2015 onwards
|
#if (__cplusplus >= 201103L) || !defined(_MSC_VER) || (_MSC_VER >= 1900) // C++11 and MSVC 2015 onwards
|
||||||
# define threadlocal thread_local
|
#define threadlocal thread_local
|
||||||
# else
|
#else
|
||||||
# if defined(_MSC_VER) && (_MSC_VER >= 1800) // there's an alternative for MSVC 2013
|
#if defined(_MSC_VER) && (_MSC_VER >= 1800) // there's an alternative for MSVC 2013
|
||||||
# define threadlocal __declspec(thread)
|
#define threadlocal __declspec(thread)
|
||||||
# else
|
#else
|
||||||
# define threadlocal
|
#define threadlocal
|
||||||
# endif
|
#endif
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
@ -121,8 +121,9 @@ M3DWrapper::~M3DWrapper() {
|
||||||
|
|
||||||
void M3DWrapper::reset() {
|
void M3DWrapper::reset() {
|
||||||
ClearSave();
|
ClearSave();
|
||||||
if (m3d_)
|
if (m3d_) {
|
||||||
m3d_free(m3d_);
|
m3d_free(m3d_);
|
||||||
|
}
|
||||||
m3d_ = nullptr;
|
m3d_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue