[grilo-plugins/0.1.x] gravatar: Don't leak GParamSpec



commit 9008c7e4c256380eb14c8fedec20fa98ca327e22
Author: Jens Georg <jensg openismus com>
Date:   Tue Jul 17 11:18:53 2012 +0200

    gravatar: Don't leak GParamSpec
    
    The GParamSpecPool in the plugin registry takes a reference of the param
    spec so it needs to be unrefed in any case, not just in error.
    
    Under contract for Canonical Ltd.
    
    This fixes https://bugzilla.gnome.org/show_bug.cgi?id=680435

 src/metadata/gravatar/grl-gravatar.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/metadata/gravatar/grl-gravatar.c b/src/metadata/gravatar/grl-gravatar.c
index fd2b326..68b0133 100644
--- a/src/metadata/gravatar/grl-gravatar.c
+++ b/src/metadata/gravatar/grl-gravatar.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, 2011 Igalia S.L.
+ * Copyright (C) 2012 Canonical Ltd.
  *
  * Contact: Iago Toral Quiroga <itoral igalia com>
  *
@@ -168,11 +169,11 @@ register_gravatar_key (GrlPluginRegistry *registry,
                               G_PARAM_READWRITE);
 
   key = grl_plugin_registry_register_metadata_key (registry, spec, NULL);
+  g_param_spec_unref (spec);
 
   /* If key was not registered, could be that it is already registered. If so,
      check if type is the expected one, and reuse it */
   if (!key) {
-    g_param_spec_unref (spec);
     key = grl_plugin_registry_lookup_metadata_key (registry, name);
     if (!key || GRL_METADATA_KEY_GET_TYPE (key) != G_TYPE_STRING) {
       key = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]