[Xfce4-commits] <tumbler:master> Fix a few memory leaks.

Jannis Pohlmann noreply at xfce.org
Mon Nov 23 21:02:01 CET 2009


Updating branch refs/heads/master
         to 4d3d26289217e1b2adfdd1899b36a87561030aff (commit)
       from 075c04125bee186bff24cc79d642982e7633f0c6 (commit)

commit 4d3d26289217e1b2adfdd1899b36a87561030aff
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Mon Nov 23 20:44:46 2009 +0100

    Fix a few memory leaks.

 tumbler/tumbler-thumbnailer.c     |    2 ++
 tumblerd/tumbler-lifo-scheduler.c |    3 +++
 tumblerd/tumbler-manager.c        |   14 +++++++++++---
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c
index d40c1b8..cc350da 100644
--- a/tumbler/tumbler-thumbnailer.c
+++ b/tumbler/tumbler-thumbnailer.c
@@ -208,6 +208,8 @@ tumbler_thumbnailer_supports_hash_key (TumblerThumbnailer *thumbnailer,
     if (g_strcmp0 (hash_keys[n], hash_key) == 0)
       supported = TRUE;
 
+  g_strfreev (hash_keys);
+
   return supported;
 }
 
diff --git a/tumblerd/tumbler-lifo-scheduler.c b/tumblerd/tumbler-lifo-scheduler.c
index 82a3f56..7c89ef3 100644
--- a/tumblerd/tumbler-lifo-scheduler.c
+++ b/tumblerd/tumbler-lifo-scheduler.c
@@ -36,6 +36,7 @@
 #include <tumblerd/tumbler-scheduler.h>
 
 
+
 /* Property identifiers */
 enum
 {
@@ -43,6 +44,8 @@ enum
   PROP_NAME,
 };
 
+
+
 static void tumbler_lifo_scheduler_iface_init        (TumblerSchedulerIface     *iface);
 static void tumbler_lifo_scheduler_finalize          (GObject                   *object);
 static void tumbler_lifo_scheduler_get_property      (GObject                   *object,
diff --git a/tumblerd/tumbler-manager.c b/tumblerd/tumbler-manager.c
index 1b14117..f28c305 100644
--- a/tumblerd/tumbler-manager.c
+++ b/tumblerd/tumbler-manager.c
@@ -625,8 +625,6 @@ tumbler_manager_load_overrides_file (TumblerManager *manager,
         }
       else
         {
-          g_free (hash_key);
-
           first = FALSE;
           inserted = FALSE;
 
@@ -665,6 +663,8 @@ tumbler_manager_load_overrides_file (TumblerManager *manager,
                * have a new info at the very beginning of the list */
               tumbler_manager_update_preferred (manager, hash_key);
             }
+
+          g_free (hash_key);
         }
     }
 
@@ -743,6 +743,7 @@ tumbler_manager_unload_overrides_file (TumblerManager *manager,
   GFile         *directory;
   GList         *lp;
   GList        **overrides;
+  gchar         *hash_key_copy;
   gint           dir_index;
 
   g_return_if_fail (TUMBLER_IS_MANAGER (manager));
@@ -798,6 +799,10 @@ tumbler_manager_unload_overrides_file (TumblerManager *manager,
             }
         }
 
+      /* we need to copy the hash key here as we'll remove it from
+       * the hash table next */
+      hash_key_copy = g_strdup (hash_key);
+
       /* if there is no element left after removing the matching ones, we
        * need to remove the entire list from the hash table */
       if (*overrides == NULL)
@@ -806,7 +811,10 @@ tumbler_manager_unload_overrides_file (TumblerManager *manager,
       /* if we removed an info from the list and it was the first one, we
        * need to update the preferred thumbnailer for this hash key now */
       if (first)
-        tumbler_manager_update_preferred (manager, hash_key);
+        tumbler_manager_update_preferred (manager, hash_key_copy);
+
+      /* free the hash key copy */
+      g_free (hash_key_copy);
     }
 }
 



More information about the Xfce4-commits mailing list