From c6d06ec012aff7a635197c57bd3ba792232b7e50 Mon Sep 17 00:00:00 2001 From: insunaa Date: Thu, 28 Sep 2023 21:51:06 +0200 Subject: [PATCH] Fix memory leak in G3D::Array Bug introduced in https://github.com/cmangos/mangos-wotlk/commit/2fa08e3b998c80a43d54c082a30191f18a48b0ac --- dep/g3dlite/System.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dep/g3dlite/System.cpp b/dep/g3dlite/System.cpp index 6daa3bd534..7630aef9b4 100644 --- a/dep/g3dlite/System.cpp +++ b/dep/g3dlite/System.cpp @@ -1334,11 +1334,12 @@ class BufferPool { ++medPoolSize; return; } - bytesAllocated -= USERSIZE_TO_REALSIZE(bytes); - - // Free; the buffer pools are full or this is too big to store. - ::free(USERPTR_TO_REALPTR(ptr)); } + + bytesAllocated -= USERSIZE_TO_REALSIZE(bytes); + + // Free; the buffer pools are full or this is too big to store. + ::free(USERPTR_TO_REALPTR(ptr)); } }