Fix memory leak in Collada ZAE and 3MF ZipFile reading
Must close the file!pull/2545/head
parent
9e04df810e
commit
5c6ea5d7ba
|
@ -149,14 +149,14 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
|
|||
|
||||
ASSIMP_LOG_DEBUG(rootFile);
|
||||
|
||||
mZipArchive->Close(fileStream);
|
||||
|
||||
mRootStream = mZipArchive->Open(rootFile.c_str());
|
||||
ai_assert( mRootStream != nullptr );
|
||||
if ( nullptr == mRootStream ) {
|
||||
throw DeadlyExportError( "Cannot open root-file in archive : " + rootFile );
|
||||
}
|
||||
|
||||
mZipArchive->Close( fileStream );
|
||||
|
||||
} else if( file == D3MF::XmlTag::CONTENT_TYPES_ARCHIVE) {
|
||||
ASSIMP_LOG_WARN_F("Ignored file of unsupported type CONTENT_TYPES_ARCHIVES",file);
|
||||
} else {
|
||||
|
@ -167,7 +167,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
|
|||
}
|
||||
|
||||
D3MFOpcPackage::~D3MFOpcPackage() {
|
||||
// empty
|
||||
mZipArchive->Close(mRootStream);
|
||||
}
|
||||
|
||||
IOStream* D3MFOpcPackage::RootStream() const {
|
||||
|
|
|
@ -165,7 +165,7 @@ std::string ColladaParser::ReadZaeManifest(ZipArchiveIOSystem &zip_archive) {
|
|||
}
|
||||
|
||||
std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(manifestfile.get()));
|
||||
irr::io::IrrXMLReader* manifest_reader = irr::io::createIrrXMLReader(mIOWrapper.get());
|
||||
std::unique_ptr<irr::io::IrrXMLReader> manifest_reader(irr::io::createIrrXMLReader(mIOWrapper.get()));
|
||||
|
||||
while (manifest_reader->read())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue