From f58d7119818a939437bdf22b66af43a48af2ebb4 Mon Sep 17 00:00:00 2001 From: ceeac Date: Fri, 26 May 2017 10:04:13 +0200 Subject: [PATCH] Fix memory leak in Path::getDirectory. --- src/openrct2/core/Path.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openrct2/core/Path.cpp b/src/openrct2/core/Path.cpp index 0b3f9f5c96..849b78a50d 100644 --- a/src/openrct2/core/Path.cpp +++ b/src/openrct2/core/Path.cpp @@ -44,7 +44,10 @@ namespace Path std::string GetDirectory(const std::string &path) { - return GetDirectory(path.c_str()); + const utf8* directory = GetDirectory(path.c_str()); + std::string result(directory); + Memory::Free(directory); + return result; } utf8 * GetDirectory(const utf8 * path)