Script: Fix handle leak with unclosed script file

This commit is contained in:
Birunthan Mohanathas 2013-03-17 17:56:52 +02:00
parent 226416193e
commit 5d6794ce7b

View File

@ -59,6 +59,9 @@ bool LuaScript::Initialize(const std::wstring& scriptFile)
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
fread(fileData, fileSize, 1, file); fread(fileData, fileSize, 1, file);
fclose(file);
file = NULL;
int load = luaL_loadbuffer(L, fileData, fileSize, ""); int load = luaL_loadbuffer(L, fileData, fileSize, "");
delete [] fileData; delete [] fileData;