From d23d3fcff561b6cf845a62d109be499fa15de4fc 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 0e64c4c6..3a8f724f 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; }