Plug mem leak in g_dbus_address_get_stream_sync
[platform/upstream/glib.git] / gio / gdbusaddress.c
index 923c973..5d8fc9c 100644 (file)
@@ -1,6 +1,6 @@
 /* GDBus - GLib D-Bus Library
  *
- * Copyright (C) 2008-2009 Red Hat, Inc.
+ * Copyright (C) 2008-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -46,7 +46,7 @@
  *
  * Routines for working with D-Bus addresses. A D-Bus address is a string
  * like "unix:tmpdir=/tmp/my-app-name". The exact format of addresses
- * is explained in detail in the <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html#addresses">D-Bus specification</link>.
+ * is explained in detail in the <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html&num;addresses">D-Bus specification</link>.
  */
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -396,10 +396,10 @@ g_dbus_is_supported_address (const gchar  *string,
 }
 
 gboolean
-_g_dbus_address_parse_entry (const gchar   *address_entry,
-                             gchar        **out_transport_name,
-                             GHashTable   **out_key_value_pairs,
-                             GError       **error)
+_g_dbus_address_parse_entry (const gchar  *address_entry,
+                             gchar       **out_transport_name,
+                             GHashTable  **out_key_value_pairs,
+                             GError      **error)
 {
   gboolean ret;
   GHashTable *key_value_pairs;
@@ -485,11 +485,11 @@ out:
  * making libgio link to libX11...
  */
 static GIOStream *
-g_dbus_address_connect (const gchar    *address_entry,
-                        const gchar    *transport_name,
-                        GHashTable     *key_value_pairs,
-                        GCancellable   *cancellable,
-                        GError        **error)
+g_dbus_address_connect (const gchar   *address_entry,
+                        const gchar   *transport_name,
+                        GHashTable    *key_value_pairs,
+                        GCancellable  *cancellable,
+                        GError       **error)
 {
   GIOStream *ret;
   GSocketConnectable *connectable;
@@ -669,10 +669,10 @@ g_dbus_address_connect (const gchar    *address_entry,
 }
 
 static GIOStream *
-g_dbus_address_try_connect_one (const gchar         *address_entry,
-                                gchar              **out_guid,
-                                GCancellable        *cancellable,
-                                GError             **error)
+g_dbus_address_try_connect_one (const gchar   *address_entry,
+                                gchar        **out_guid,
+                                GCancellable  *cancellable,
+                                GError       **error)
 {
   GIOStream *ret;
   GHashTable *key_value_pairs;
@@ -856,10 +856,10 @@ g_dbus_address_get_stream_finish (GAsyncResult        *res,
  * Since: 2.26
  */
 GIOStream *
-g_dbus_address_get_stream_sync (const gchar         *address,
-                                gchar              **out_guid,
-                                GCancellable        *cancellable,
-                                GError             **error)
+g_dbus_address_get_stream_sync (const gchar   *address,
+                                gchar        **out_guid,
+                                GCancellable  *cancellable,
+                                GError       **error)
 {
   GIOStream *ret;
   gchar **addr_array;
@@ -907,6 +907,8 @@ g_dbus_address_get_stream_sync (const gchar         *address,
       g_assert (last_error != NULL);
       g_propagate_error (error, last_error);
     }
+
+  g_strfreev (addr_array);
   return ret;
 }