From 35b13adf03cd59b70b33321cb4168082a079b2e1 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 27 Dec 2023 11:25:09 +0300 Subject: [PATCH] Fixed leak at WorldFiles::getLights --- src/files/WorldFiles.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/files/WorldFiles.cpp b/src/files/WorldFiles.cpp index 5c82a8340..c62e1d12b 100644 --- a/src/files/WorldFiles.cpp +++ b/src/files/WorldFiles.cpp @@ -207,10 +207,10 @@ ubyte* WorldFiles::getChunk(int x, int z){ } light_t* WorldFiles::getLights(int x, int z) { - ubyte* data = getData(lights, getLightsFolder(), x, z, REGION_LAYER_LIGHTS); + std::unique_ptr data (getData(lights, getLightsFolder(), x, z, REGION_LAYER_LIGHTS)); if (data == nullptr) return nullptr; - return Lightmap::decode(data); + return Lightmap::decode(data.get()); } ubyte* WorldFiles::getData(regionsmap& regions, const fs::path& folder,