[evolution] Bug 627852 - Memory leak in em_format_push_level()
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 627852 - Memory leak in em_format_push_level()
- Date: Fri, 27 Aug 2010 14:49:26 +0000 (UTC)
commit 9cbc19e94931c69e93e0e8e3847d017568bd0979
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Aug 27 10:49:08 2010 -0400
Bug 627852 - Memory leak in em_format_push_level()
em-format/em-format.c | 54 +++++++++++++++++++++++++++++-------------------
1 files changed, 33 insertions(+), 21 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 9873a84..f07d6e3 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -111,6 +111,28 @@ emf_clone_inlines (gpointer key, gpointer val, gpointer data)
g_object_ref ((new->secured = emfc->secured));
}
+static gboolean
+emf_clear_puri_node (GNode *node)
+{
+ GQueue *queue = node->data;
+ EMFormatPURI *pn;
+
+ while ((pn = g_queue_pop_head (queue)) != NULL) {
+ if (pn->free != NULL)
+ pn->free (pn);
+ g_free (pn->uri);
+ g_free (pn->cid);
+ g_free (pn->part_id);
+ if (pn->part != NULL)
+ g_object_unref (pn->part);
+ g_free (pn);
+ }
+
+ g_queue_free (queue);
+
+ return FALSE;
+}
+
static void
emf_finalize (GObject *object)
{
@@ -134,6 +156,17 @@ emf_finalize (GObject *object)
g_string_free(emf->part_id, TRUE);
g_free(emf->uid);
+ if (emf->pending_uri_table != NULL)
+ g_hash_table_destroy (emf->pending_uri_table);
+
+ if (emf->pending_uri_tree != NULL) {
+ g_node_traverse (
+ emf->pending_uri_tree,
+ G_IN_ORDER, G_TRAVERSE_ALL, -1,
+ (GNodeTraverseFunc) emf_clear_puri_node, NULL);
+ g_node_destroy (emf->pending_uri_tree);
+ }
+
/* FIXME: check pending jobs */
/* Chain up to parent's finalize() method. */
@@ -725,27 +758,6 @@ em_format_find_puri (EMFormat *emf,
return g_hash_table_lookup (emf->pending_uri_table, uri);
}
-static gboolean
-emf_clear_puri_node (GNode *node)
-{
- GQueue *queue = node->data;
- EMFormatPURI *pn;
-
- while ((pn = g_queue_pop_head (queue)) != NULL) {
- d(printf ("freeing pw %p format:%p\n", pw, pw->format));
- if (pn->free)
- pn->free(pn);
- g_free(pn->uri);
- g_free(pn->cid);
- g_free(pn->part_id);
- if (pn->part)
- g_object_unref (pn->part);
- g_free(pn);
- }
-
- return FALSE;
-}
-
/**
* em_format_clear_puri_tree:
* @emf:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]