Package: libg3d / 0.0.8-20

fix-memory-leaks-dae.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Fix memory leaks in dae plugin
Forwarded: https://mail.gna.org/public/libg3d-devel/2010-08/msg00000.html
Author: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
Bug-Debian: http://bugs.debian.org/593209

---
diff --git a/plugins/import/imp_dae/imp_dae_cb.c b/plugins/import/imp_dae/imp_dae_cb.c
index 5981fb0cc916036333ba23ae757961a2b6418d8f..eabdda7562aca6c7d1b2419353e90bbea5ab7502 100644
--- a/plugins/import/imp_dae/imp_dae_cb.c
+++ b/plugins/import/imp_dae/imp_dae_cb.c
@@ -806,6 +806,10 @@ gboolean dae_cb_vertices__input(DaeGlobalData *global, DaeLocalData *local)
 		g_return_val_if_fail(cnt != NULL, FALSE);
 
 		object->vertex_count = atoi(cnt);
+
+		if(cnt)
+			g_free(cnt);
+
 		g_return_val_if_fail(object->vertex_count != 0, FALSE);
 
 		object->vertex_data = g_new0(gfloat, 3 * object->vertex_count);
diff --git a/plugins/import/imp_dae/imp_dae_library.c b/plugins/import/imp_dae/imp_dae_library.c
index dd103513cb46def1a6d160a7a216421584e67266..9312a60dc013532b541cecb78a84686f415246f7 100644
--- a/plugins/import/imp_dae/imp_dae_library.c
+++ b/plugins/import/imp_dae/imp_dae_library.c
@@ -158,6 +158,7 @@ void dae_library_cleanup(DaeLibrary *library)
 		nodelib = (DaeLibraryNodes *)item->data;
 		g_hash_table_destroy(nodelib->ids);
 		g_slist_free(nodelib->nodes);
+		g_free(nodelib);
 	}
 
 	g_hash_table_destroy(library->ids);