empathy r1229 - trunk/libempathy



Author: xclaesse
Date: Mon Jul 14 11:01:21 2008
New Revision: 1229
URL: http://svn.gnome.org/viewvc/empathy?rev=1229&view=rev

Log:
Really fix the leak. Address is created using g_value_dup_boxed so it should be freed using g_boxed_free.


Modified:
   trunk/libempathy/empathy-tp-tube.c

Modified: trunk/libempathy/empathy-tp-tube.c
==============================================================================
--- trunk/libempathy/empathy-tp-tube.c	(original)
+++ trunk/libempathy/empathy-tp-tube.c	Mon Jul 14 11:01:21 2008
@@ -477,9 +477,12 @@
   EmpathyTpTubePriv *priv = GET_PRIV (tube);
   GValue *address;
   guint address_type;
+  gchar *ret_hostname = NULL;
+  guint ret_port;
   GError *error = NULL;
 
   g_return_if_fail (EMPATHY_IS_TP_TUBE (tube));
+  g_return_if_fail (hostname != NULL || port != NULL);
 
   DEBUG ("Getting stream tube socket address");
 
@@ -495,14 +498,20 @@
     {
     case TP_SOCKET_ADDRESS_TYPE_UNIX:
     case TP_SOCKET_ADDRESS_TYPE_ABSTRACT_UNIX:
-        dbus_g_type_struct_get (address, 0, hostname, G_MAXUINT);
+        dbus_g_type_struct_get (address, 0, &ret_hostname, G_MAXUINT);
         break;
     case TP_SOCKET_ADDRESS_TYPE_IPV4:
     case TP_SOCKET_ADDRESS_TYPE_IPV6:
-        dbus_g_type_struct_get (address, 0, hostname, 1, port, G_MAXUINT);    
+        dbus_g_type_struct_get (address, 0, &ret_hostname, 1, &ret_port, G_MAXUINT);    
         break;
     }
 
-  g_free (address);
+  if (hostname) {
+  	*hostname = g_strdup (ret_hostname);
+  }
+  if (port) {
+  	*port = ret_port;
+  }
+  g_boxed_free (G_TYPE_VALUE, address);
 }
 



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