[folks] Bug 635703 – Leak in connection_get_requestable_channel_classes_cb



commit 957dc5ca25f23724f120c1bf2c4257e7ea421577
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Nov 27 21:32:41 2010 +0000

    Bug 635703 â?? Leak in connection_get_requestable_channel_classes_cb
    
    Tidy up memory handling in the function so that it doesn't leak in odd
    conditions. Closes: bgo#635703

 NEWS                                 |    1 +
 backends/telepathy/lib/tp-lowlevel.c |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 47cfea9..55f9ab3 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Bugs fixed:
 * Bug 635178 â?? Leak in
   folks_tp_lowlevel_connection_open_contact_list_channel_async
 * Bug 635649 â?? autopoint fails to run
+* Bug 635703 â?? Leak in connection_get_requestable_channel_classes_cb
 
 Overview of changes from libfolks 0.3.1 to libfolks 0.3.2
 ==========================================================
diff --git a/backends/telepathy/lib/tp-lowlevel.c b/backends/telepathy/lib/tp-lowlevel.c
index 834e167..e7f7f16 100644
--- a/backends/telepathy/lib/tp-lowlevel.c
+++ b/backends/telepathy/lib/tp-lowlevel.c
@@ -433,7 +433,7 @@ connection_get_requestable_channel_classes_cb (TpProxy *conn,
     GObject *weak_object)
 {
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-  gpointer props;
+  GPtrArray *props;
 
   if (error != NULL)
     {
@@ -441,8 +441,9 @@ connection_get_requestable_channel_classes_cb (TpProxy *conn,
     }
   else
     {
-      props = g_value_dup_boxed (value);
-      g_simple_async_result_set_op_res_gpointer (simple, props, NULL);
+      props = (GPtrArray*) g_value_get_boxed (value);
+      g_simple_async_result_set_op_res_gpointer (simple,
+          g_ptr_array_ref (props), (GDestroyNotify) g_ptr_array_unref);
     }
 
   g_simple_async_result_complete (simple);
@@ -485,6 +486,7 @@ folks_tp_lowlevel_connection_get_requestable_channel_classes_finish (
     GError **error)
 {
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
+  GPtrArray *props;
   TpConnection *conn;
 
   g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), NULL);
@@ -500,8 +502,9 @@ folks_tp_lowlevel_connection_get_requestable_channel_classes_finish (
       folks_tp_lowlevel_connection_get_requestable_channel_classes_finish),
       NULL);
 
-  return g_simple_async_result_get_op_res_gpointer (
+  props = (GPtrArray*) g_simple_async_result_get_op_res_gpointer (
       G_SIMPLE_ASYNC_RESULT (result));
+  return g_ptr_array_ref (props);
 }
 
 static void



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