summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-02 13:44:12 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-09 13:25:12 +0000
commitd0811d73bd94f31fa9434091441951467884c92f (patch)
tree719b40300da546b7f034c881916eb7d6ec5bed0e
parent4d43c14e47ae3b67a83ff88bc39c34e02ad15434 (diff)
downloadtelepathy-glib-d0811d73bd94f31fa9434091441951467884c92f.tar.gz
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. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45554 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--telepathy-glib/simple-password-manager.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/telepathy-glib/simple-password-manager.c b/telepathy-glib/simple-password-manager.c
index cdb75b8d9..50d2ecee6 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);