From bcf00c06adf9aa27f95a42ddd250bb3df07524c1 Mon Sep 17 00:00:00 2001 From: Tunacan Date: Tue, 31 Aug 2021 16:49:44 +0300 Subject: [PATCH] fix memory leak --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c764a24..aec998a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -115,8 +115,9 @@ int main(int argc, char *argv[]) { p.y > floor(camera.position.y / 3.2f) + camera.renderDistance || p.z > floor(camera.position.z / 3.2f) + camera.renderDistance) { - if (c->second->mesh != nullptr) delete c->second->mesh; world->chunksWithMeshes.erase(p); + delete c->second->mesh; + c->second->mesh = nullptr; } }