fixed resource leak in OpenDecompressor

This commit is contained in:
Christoph Oelckers 2024-02-27 07:20:12 +01:00
parent 205d4b5ff3
commit ef4c4ee503
2 changed files with 2 additions and 0 deletions

View file

@ -35,6 +35,7 @@
#include <time.h> #include <time.h>
#include <stdexcept> #include <stdexcept>
#include <cstdint>
#include "w_zip.h" #include "w_zip.h"
#include "ancientzip.h" #include "ancientzip.h"
#include "resourcefile.h" #include "resourcefile.h"

View file

@ -985,6 +985,7 @@ bool OpenDecompressor(FileReader& self, FileReader &parent, FileReader::Size len
// read everything into a MemoryArrayReader. // read everything into a MemoryArrayReader.
FileData data(nullptr, length); FileData data(nullptr, length);
fr->Read(data.writable(), length); fr->Read(data.writable(), length);
delete fr;
fr = new MemoryArrayReader(data); fr = new MemoryArrayReader(data);
} }
else if ((flags & DCF_SEEKABLE)) else if ((flags & DCF_SEEKABLE))