aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-27 22:49:08 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-27 22:49:08 +0800
commit9cbc19e94931c69e93e0e8e3847d017568bd0979 (patch)
tree1264288a812cc7d7c460100b3187dc3687b975de /em-format
parentc125dbece014b0bd85c6c24d311606f87d946f6d (diff)
downloadgsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.tar
gsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.tar.gz
gsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.tar.bz2
gsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.tar.lz
gsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.tar.xz
gsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.tar.zst
gsoc2013-evolution-9cbc19e94931c69e93e0e8e3847d017568bd0979.zip
Bug 627852 - Memory leak in em_format_push_level()
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format.c54
1 files changed, 33 insertions, 21 deletions
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 9873a84ea3..f07d6e3c5a 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: