summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-03-21 09:27:15 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-03-21 09:27:15 +0000
commit807c680b413dbef620a9ee560493f56cfc945184 (patch)
tree3961e8fc6d0e01490ea266c08e9475fe0ff070e2
parentff6037a2a24288d80fa201bd00b0dc9b5d668971 (diff)
meta-porter: don't leak the stanza if send_iq_finish wasn't called
We get a new ref to the new stanza from the c2s porter's send_iq_finish. We now set that as the simple async result's gpointer with free func of g_object_unref. The finish func returns a new ref to the stanza so that when the simple async result is completed it unrefs the stanza leaving the only ref in the callback (unless it has already been unreffed there). Bingo. Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--wocky/wocky-meta-porter.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/wocky/wocky-meta-porter.c b/wocky/wocky-meta-porter.c
index 8937722..5246b22 100644
--- a/wocky/wocky-meta-porter.c
+++ b/wocky/wocky-meta-porter.c
@@ -1366,7 +1366,7 @@ meta_porter_send_iq_cb (GObject *source_object,
if (stanza == NULL)
g_simple_async_result_take_error (simple, error);
else
- g_simple_async_result_set_op_res_gpointer (simple, stanza, NULL);
+ g_simple_async_result_set_op_res_gpointer (simple, stanza, g_object_unref);
g_simple_async_result_complete (simple);
g_object_unref (simple);
@@ -1450,7 +1450,8 @@ wocky_meta_porter_send_iq_finish (WockyPorter *self,
GAsyncResult *result,
GError **error)
{
- wocky_implement_finish_return_pointer (self, wocky_meta_porter_send_iq_async);
+ wocky_implement_finish_return_copy_pointer (self, wocky_meta_porter_send_iq_async,
+ g_object_ref);
}
static void