Fix: Close leak.

- closes https://github.com/assimp/assimp/issues/3416
kimkulling/close_memleak-issue-3416
Kim Kulling 2023-02-02 20:52:40 +01:00 committed by GitHub
parent ea7321aae2
commit 1eb2c124a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team Copyright (c) 2006-2023, assimp team
All rights reserved. All rights reserved.
@ -66,11 +65,7 @@ namespace Assimp {
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
class MemoryIOStream : public IOStream { class MemoryIOStream : public IOStream {
public: public:
MemoryIOStream (const uint8_t* buff, size_t len, bool own = false) MemoryIOStream (const uint8_t* buff, size_t len, bool own = false) : buffer (buff), length(len), pos((size_t)0), own(own) {
: buffer (buff)
, length(len)
, pos((size_t)0)
, own(own) {
// empty // empty
} }
@ -162,7 +157,11 @@ public:
} }
/** Destructor. */ /** Destructor. */
~MemoryIOSystem() = default; ~MemoryIOSystem() {
for (auto &it : created_streams) {
MemoryIOSystem::Close(it);
}
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Tests for the existence of a file at the given path. */ /** Tests for the existence of a file at the given path. */