[folks] Don't free the return value of transfer-full TpLowlevel functions.



commit 8dc6a2a39f859b49b964e314234c30b37c883c1e
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Tue Aug 17 16:07:07 2010 -0700

    Don't free the return value of transfer-full TpLowlevel functions.
    
    These transfer return value ownership, so we're asking for a double-free error.

 backends/telepathy/tp-lowlevel.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/backends/telepathy/tp-lowlevel.c b/backends/telepathy/tp-lowlevel.c
index 8103d7e..e65d81e 100644
--- a/backends/telepathy/tp-lowlevel.c
+++ b/backends/telepathy/tp-lowlevel.c
@@ -64,7 +64,7 @@ connection_ensure_channel_cb (TpConnection *conn,
       /* FIXME: pass in an error here and react to it */
       channel = tp_channel_new_from_properties (conn, path, properties, NULL);
       g_simple_async_result_set_op_res_gpointer (simple, g_object_ref (channel),
-          g_object_unref);
+          NULL);
 
       g_object_unref (channel);
     }
@@ -123,13 +123,6 @@ folks_tp_lowlevel_connection_open_contact_list_channel_finish (
 }
 
 static void
-contact_list_free (GList *contact_list)
-{
-  g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
-  g_list_free (contact_list);
-}
-
-static void
 get_contacts_by_handle_cb (TpConnection *conn,
     guint n_contacts,
     TpContact * const *contacts,
@@ -154,8 +147,7 @@ get_contacts_by_handle_cb (TpConnection *conn,
         contact_list = g_list_prepend (contact_list,
             g_object_ref (contacts[i]));
 
-      g_simple_async_result_set_op_res_gpointer (simple, contact_list,
-          (GDestroyNotify) contact_list_free);
+      g_simple_async_result_set_op_res_gpointer (simple, contact_list, NULL);
     }
 
   g_simple_async_result_complete (simple);
@@ -267,8 +259,7 @@ get_contacts_by_id_cb (TpConnection *conn,
         contact_list = g_list_prepend (contact_list,
             g_object_ref (contacts[i]));
 
-      g_simple_async_result_set_op_res_gpointer (simple, contact_list,
-          (GDestroyNotify) contact_list_free);
+      g_simple_async_result_set_op_res_gpointer (simple, contact_list, NULL);
     }
 
   g_simple_async_result_complete (simple);



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