1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Fix mismatched allocator/deallocater for S6

This commit is contained in:
Michał Janiszewski
2017-04-24 22:29:50 +02:00
parent eaac6759fe
commit a83dd095d6

View File

@@ -1,4 +1,4 @@
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
@@ -24,6 +24,7 @@
#include "../object/ObjectRepository.h"
#include "../rct12/SawyerChunkWriter.h"
#include "S6Exporter.h"
#include <functional>
extern "C"
{
@@ -138,7 +139,7 @@ void S6Exporter::Save(IStream * stream, bool isScenario)
// Read all written bytes back into a single buffer
stream->SetPosition(0);
auto data = std::unique_ptr<uint8>(stream->ReadArray<uint8>(fileSize));
auto data = std::unique_ptr<uint8, std::function<void(uint8*)>>(stream->ReadArray<uint8>(fileSize), Memory::Free<uint8>);
uint32 checksum = sawyercoding_calculate_checksum(data.get(), fileSize);
// Write the checksum on the end