aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeno- <kde.psych@gmail.com>2016-11-05 15:10:49 +1000
committerGitHub <noreply@github.com>2016-11-05 15:10:49 +1000
commitb5c84c34ce283a56317902d24067d9a0795a44c5 (patch)
tree5b21acd6cecf41d092e784b7a3db9fc522b069bc
parent6bb43472082d8003a6cd140c1221c81005fdd752 (diff)
downloadminetest-b5c84c34ce283a56317902d24067d9a0795a44c5.tar.gz
minetest-b5c84c34ce283a56317902d24067d9a0795a44c5.tar.bz2
minetest-b5c84c34ce283a56317902d24067d9a0795a44c5.zip
Fix memory leak in ::safeLoadFile (#4730)
-rw-r--r--src/script/cpp_api/s_security.cpp3
1 files changed, 3 insertions, 0 deletions
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;
}