From b841bd131a6027e6588bcd136df14be4a333ee1d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 2 Feb 2012 13:44:12 +0000 Subject: [PATCH 6/7] TpSimplePasswordManager: copy the string into the result Otherwise, if a caller kept a ref to the GAsyncResult after control had returned to the channel, the channel could have freed the GString already. --- telepathy-glib/simple-password-manager.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/telepathy-glib/simple-password-manager.c b/telepathy-glib/simple-password-manager.c index cdb75b8..50d2ece 100644 --- a/telepathy-glib/simple-password-manager.c +++ b/telepathy-glib/simple-password-manager.c @@ -305,6 +305,12 @@ tp_simple_password_manager_channel_closed_cb (GObject *chan, } static void +free_gstring (gpointer p) +{ + g_string_free (p, TRUE); +} + +static void tp_simple_password_manager_channel_finished_cb ( TpBasePasswordChannel *channel, const GString *str, @@ -325,7 +331,7 @@ tp_simple_password_manager_channel_finished_cb ( else { g_simple_async_result_set_op_res_gpointer ( - result, (gpointer) str, NULL); + result, g_boxed_copy (G_TYPE_GSTRING, str), free_gstring); } g_simple_async_result_complete (result); -- 1.7.9