[Libreoffice-commits] core.git: external/libgltf

Zolnai Tamás tamas.zolnai at collabora.com
Mon May 26 14:44:07 PDT 2014


 external/libgltf/UnpackedTarball_libgltf.mk      |    1 
 external/libgltf/patches/free_file_buffers.patch |   58 +++++++++++++++++++++++
 2 files changed, 59 insertions(+)

New commits:
commit 37dd6ced1e1763b2da2d08f5dd0df1bf7a6458a9
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon May 26 23:40:51 2014 +0200

    patching libgltf: stop a huge memory leak
    
    It is ambiguos where we should free file buffers because they
    are allocated by the caller code, but since gltfHandle is
    deallocated inside libgltf and libgltf has a gltf_renderer_release
    method for deallocation it seems better to free them by libgltf.
    
    
    Conflicts:
    	external/libgltf/UnpackedTarball_libgltf.mk
    
    Change-Id: If3d9abed0514128c13cde8c1967ea80c4d27bf59

diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index 33889fb..99609ba 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
 	external/libgltf/patches/include_path_glew.patch \
 	external/libgltf/patches/include_path_freetype.patch \
 	external/libgltf/patches/openmp-disable.patch \
+	external/libgltf/patches/free_file_buffers.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/free_file_buffers.patch b/external/libgltf/patches/free_file_buffers.patch
new file mode 100644
index 0000000..9f92da3
--- /dev/null
+++ b/external/libgltf/patches/free_file_buffers.patch
@@ -0,0 +1,58 @@
+diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp
+--- libgltf.org/src/LoadScene.cpp	2014-05-26 21:46:51.986986538 +0200
++++ libgltf/src/LoadScene.cpp	2014-05-26 21:47:28.206985004 +0200
+@@ -127,7 +127,7 @@
+     return gHandle;
+ }
+ 
+-bool Parser::releaseFileName()
++bool Parser::releaseFiles()
+ {
+     glTFHandle* gHandle = pScene->getGltfHandle();
+     for (int i = (int)gHandle->size - 1 ; i >= 0 ; i--)
+@@ -137,6 +137,7 @@
+             free(gHandle->files[i].filename);
+             gHandle->files[i].filename = NULL;
+         }
++        delete [] gHandle->files[i].buffer;
+     }
+ 
+     if (gHandle->files != NULL)
+diff -ur libgltf.org/src/LoadScene.h libgltf/src/LoadScene.h
+--- libgltf.org/src/LoadScene.h	2014-05-26 21:46:51.986986538 +0200
++++ libgltf/src/LoadScene.h	2014-05-26 21:47:33.170984793 +0200
+@@ -26,7 +26,7 @@
+ {
+ public:
+     glTFHandle* getFileNameInJson(const std::string& jsonFile);
+-    bool releaseFileName();
++    bool releaseFiles();
+     int parseScene(Scene* pscene);
+     bool parseJsonFile();
+     void setJsonInfo(const std::string& sbuffer);
+@@ -81,4 +81,4 @@
+     bool is_json_in_buffer;
+ };
+ 
+-#endif
+\ No newline at end of file
++#endif
+diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
+--- libgltf.org/src/RenderScene.cpp	2014-05-26 21:46:51.986986538 +0200
++++ libgltf/src/RenderScene.cpp	2014-05-26 21:47:39.358984531 +0200
+@@ -1426,7 +1426,7 @@
+ 
+ void RenderScene::releaseRender()
+ {
+-    mLoadJson.releaseFileName();
++    mLoadJson.releaseFiles();
+     fbo.releaseFbo();
+     return;
+ }
+@@ -1543,4 +1543,4 @@
+ int  RenderScene::isAnimPlay()
+ {
+     return this->mAnimationPlay ? 1 : 0;
+-}
+\ No newline at end of file
++}


More information about the Libreoffice-commits mailing list