From b5c84c34ce283a56317902d24067d9a0795a44c5 Mon Sep 17 00:00:00 2001 From: Zeno- Date: Sat, 5 Nov 2016 15:10:49 +1000 Subject: [PATCH] Fix memory leak in ::safeLoadFile (#4730) --- src/script/cpp_api/s_security.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp index 0e64c4c61..3a8f724fe 100644 --- a/src/script/cpp_api/s_security.cpp +++ b/src/script/cpp_api/s_security.cpp @@ -323,9 +323,12 @@ bool ScriptApiSecurity::safeLoadFile(lua_State *L, const char *path) } if (luaL_loadbuffer(L, code, size, chunk_name)) { + delete [] code; return false; } + delete [] code; + if (path) { delete [] chunk_name; }