Fix memory leaks in mod storage (#7500)
authorred-001 <red-001@outlook.ie>
Sat, 30 Jun 2018 15:11:04 +0000 (16:11 +0100)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Sat, 30 Jun 2018 15:11:04 +0000 (17:11 +0200)
src/script/lua_api/l_storage.cpp
src/script/lua_api/l_storage.h

index 2a2b35a31e10ec1aae90b0403afe1e30de2886d0..caa1a55516fdc5be6c34a73d98befc26883053c6 100644 (file)
@@ -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);
index f8d102d04409274369873fc5ba9a7e2b5089531c..bfcf5ef38f732a85c5980b82da413b0dbb6d3452 100644 (file)
@@ -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);