diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-10 00:37:01 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-10 00:37:01 +0300 |
commit | ce7a21047f50c0e26ce55134ba434543c247d894 (patch) | |
tree | 21a0cb6ef5e3f5282972a7b3491cd6909aa6cbf7 | |
parent | eaec396e0f04c98b6305b7035e99717db336b5e9 (diff) |
BGE memleak fixed: game actuator does not release file buffer
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index e412fcdf748..0e0d8982527 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -105,11 +105,16 @@ static BlendFileData *load_game_data(char *filename) { fseek(file, 0L, SEEK_SET); char* filebuffer= new char[len];//MEM_mallocN(len, "text_buffer"); int sizeread = fread(filebuffer,len,1,file); - if (sizeread==1) - { + if (sizeread==1){ bfd = BLO_read_from_memory(filebuffer, len, &error); + } else { + error = BRE_UNABLE_TO_READ; } fclose(file); + // the memory is not released in BLO_read_from_memory, must do it here + delete filebuffer; + } else { + error = BRE_UNABLE_TO_OPEN; } if (!bfd) { @@ -348,7 +353,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area, initGameKeys(); initPythonConstraintBinding(); - + if (sceneconverter) { // convert and add scene |