From 227c71eb76e019873b30e2d3893b68307d51d58f Mon Sep 17 00:00:00 2001 From: red-001 Date: Sat, 30 Jun 2018 16:11:04 +0100 Subject: Fix memory leaks in mod storage (#7500) --- src/script/lua_api/l_storage.cpp | 5 +++++ src/script/lua_api/l_storage.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/script/lua_api/l_storage.cpp b/src/script/lua_api/l_storage.cpp index 2a2b35a31..caa1a5551 100644 --- a/src/script/lua_api/l_storage.cpp +++ b/src/script/lua_api/l_storage.cpp @@ -58,6 +58,11 @@ StorageRef::StorageRef(ModMetadata *object): { } +StorageRef::~StorageRef() +{ + delete m_object; +} + void StorageRef::create(lua_State *L, ModMetadata *object) { StorageRef *o = new StorageRef(object); diff --git a/src/script/lua_api/l_storage.h b/src/script/lua_api/l_storage.h index f8d102d04..bfcf5ef38 100644 --- a/src/script/lua_api/l_storage.h +++ b/src/script/lua_api/l_storage.h @@ -50,7 +50,7 @@ private: public: StorageRef(ModMetadata *object); - ~StorageRef() = default; + ~StorageRef(); static void Register(lua_State *L); static void create(lua_State *L, ModMetadata *object); -- cgit v1.2.3