From 3dfcbf17b2e6db1b21011f5ea2e74e5b480dc51c Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 24 Mar 2022 14:27:43 +0100 Subject: [PATCH] Fix memory leak in ctorNilPtrPlacementProxy --- libs/lua/LuaBridge/detail/Namespace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/lua/LuaBridge/detail/Namespace.h b/libs/lua/LuaBridge/detail/Namespace.h index 8af59cffe8..0190076d61 100644 --- a/libs/lua/LuaBridge/detail/Namespace.h +++ b/libs/lua/LuaBridge/detail/Namespace.h @@ -485,8 +485,8 @@ private: template static int ctorNilPtrPlacementProxy (lua_State* L) { - const T* newobject = new T (); - Stack::push (L, *newobject); + const T newobject; + Stack::push (L, newobject); return 1; }