aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-07-14 19:01:21 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-07-14 19:01:21 +0800
commit6976ec94624d74cc983c4f6f85a41ab6d6e31ce0 (patch)
treefae95668ba7bd75428e0f6de3423551a7073f15d /libempathy
parentc600f2479e3f7e4aa088daf92bd81aafae0e828f (diff)
downloadgsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.tar
gsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.tar.gz
gsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.tar.bz2
gsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.tar.lz
gsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.tar.xz
gsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.tar.zst
gsoc2013-empathy-6976ec94624d74cc983c4f6f85a41ab6d6e31ce0.zip
Really fix the leak. Address is created using g_value_dup_boxed so it should be freed using g_boxed_free.
svn path=/trunk/; revision=1229
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-tube.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c
index 4bd08a711..5f421ac78 100644
--- a/libempathy/empathy-tp-tube.c
+++ b/libempathy/empathy-tp-tube.c
@@ -477,9 +477,12 @@ empathy_tp_tube_get_socket (EmpathyTpTube *tube,
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 @@ empathy_tp_tube_get_socket (EmpathyTpTube *tube,
{
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);
}