[libgsf] GsfInput: prevent potential leak.



commit 08077ab8d55bc4b4a7dff814982191d5adcd5fbf
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 8 09:04:21 2013 -0500

    GsfInput: prevent potential leak.

 ChangeLog       |    5 +++++
 gsf/gsf-input.c |    7 ++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ffac7dd..c488cb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-08  Morten Welinder  <terra gnome org>
+
+       * gsf/gsf-input.c (gsf_input_dup): Simplify.  Prevent leak of
+       container ref if derived class set one.
+
 2013-03-07  Morten Welinder  <terra gnome org>
 
        * gsf/gsf-utils.c (gsf_property_settings_find): New function.
diff --git a/gsf/gsf-input.c b/gsf/gsf-input.c
index cca368c..62deb93 100644
--- a/gsf/gsf-input.c
+++ b/gsf/gsf-input.c
@@ -248,8 +248,7 @@ gsf_input_name (GsfInput *input)
  * gsf_input_container:
  * @input: the input stream
  *
- * Returns: (transfer none): but does not add a reference to @input's container.
- *     Potentially %NULL
+ * Returns: (transfer none): @input's container, potentially %NULL.
  **/
 GsfInfile *
 gsf_input_container (GsfInput *input)
@@ -292,9 +291,7 @@ gsf_input_dup (GsfInput *input, GError **err)
                }
 
                gsf_input_set_name (dst, input->name);
-               dst->container = input->container;
-               if (dst->container != NULL)
-                       g_object_ref (dst->container);
+               gsf_input_set_container (dst, input->container);
        }
        return dst;
 }


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