From 5d6794ce7b2a0533e5c1d2ba08ea842e9334e099 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 17 Mar 2013 17:56:52 +0200 Subject: [PATCH] Script: Fix handle leak with unclosed script file --- Library/lua/LuaScript.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/lua/LuaScript.cpp b/Library/lua/LuaScript.cpp index 0c71bf3c..96ede74b 100644 --- a/Library/lua/LuaScript.cpp +++ b/Library/lua/LuaScript.cpp @@ -59,6 +59,9 @@ bool LuaScript::Initialize(const std::wstring& scriptFile) fseek(file, 0, SEEK_SET); fread(fileData, fileSize, 1, file); + fclose(file); + file = NULL; + int load = luaL_loadbuffer(L, fileData, fileSize, ""); delete [] fileData;