Package: libg3d / 0.0.8-26

Fix-memory-leaks-in-dae-plugin.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
34
35
36
37
38
39
From: =?utf-8?q?Picca_Fr=C3=A9d=C3=A9ric-Emmanuel?=
 <picca@synchrotron-soleil.fr>
Date: Mon, 16 Aug 2010 21:29:29 +0200
Subject: Fix memory leaks in dae plugin

Forwarded: https://mail.gna.org/public/libg3d-devel/2010-08/msg00000.html
Bug-Debian: https://bugs.debian.org/593209
---
 plugins/import/imp_dae/imp_dae_cb.c      | 4 ++++
 plugins/import/imp_dae/imp_dae_library.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/plugins/import/imp_dae/imp_dae_cb.c b/plugins/import/imp_dae/imp_dae_cb.c
index 5981fb0..eabdda7 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 dd10351..9312a60 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);