summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-06 04:29:40 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-07-06 04:43:18 +0200
commita6da91bd2d19632cb131a732b76559461eed8ee8 (patch)
tree38d651e237aa3d73cfc3f894c6ce64159c08c939
parent6f855fed653d6cdbfb30f8cd579d5d8d7f108aba (diff)
fix memory leak in collada2gltf
Found by Lsan. Saves about 12MB per loaded model. Change-Id: Idaff5defd5affc3d9becf2a00d1e64f8d1d42e0f
-rw-r--r--external/collada2gltf/UnpackedTarball_collada2gltf.mk1
-rw-r--r--external/collada2gltf/patches/collada2gltf.fix-memory-leak.patch.125
2 files changed, 26 insertions, 0 deletions
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index db4b72ff69e7..def81f89f69d 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/G
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
external/collada2gltf/patches/wrong_uri_usage.patch.1 \
external/collada2gltf/patches/collada2gltf.new-delete-mismatch.patch.1 \
+ external/collada2gltf/patches/collada2gltf.fix-memory-leak.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/collada2gltf/patches/collada2gltf.fix-memory-leak.patch.1 b/external/collada2gltf/patches/collada2gltf.fix-memory-leak.patch.1
new file mode 100644
index 000000000000..a1fbee874263
--- /dev/null
+++ b/external/collada2gltf/patches/collada2gltf.fix-memory-leak.patch.1
@@ -0,0 +1,25 @@
+diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
+--- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-07-06 04:20:31.152197885 +0200
++++ collada2gltf/shaders/commonProfileShaders.cpp 2014-07-06 04:27:21.681181083 +0200
+@@ -495,6 +495,10 @@
+ this->_profile = profile;
+ this->_instanceProgram = new GLSLProgram(profile);
+ }
++
++ ~Pass() {
++ delete _instanceProgram;
++ }
+
+ GLSLProgram* instanceProgram() {
+ return this->_instanceProgram;
+@@ -1188,6 +1192,10 @@
+ fragmentShader->appendCode("}\n");
+
+ }
++
++ ~Technique() {
++ delete _pass;
++ }
+
+ shared_ptr <GLTF::JSONObject> parameters() {
+ return _parameters;