[gnome-online-accounts] Revert "smtp-auth, utils: Avoid needless string copies"
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] Revert "smtp-auth, utils: Avoid needless string copies"
- Date: Thu, 14 Jul 2016 16:28:24 +0000 (UTC)
commit 6e7f17c5dad61e112aa3a143331d45dfb9576115
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jul 14 18:02:20 2016 +0200
Revert "smtp-auth, utils: Avoid needless string copies"
Even though we already have our own reference on the GObject, the
value of its properties can still change behind our backs if we are not
on the thread where the object was constructed.
This reverts commit ebb1d81e1e8c29a4a9888cdb2a7752a58d2b954f.
src/goabackend/goasmtpauth.c | 6 ++++--
src/goabackend/goautils.c | 10 +++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/goabackend/goasmtpauth.c b/src/goabackend/goasmtpauth.c
index 91d15cd..0161baf 100644
--- a/src/goabackend/goasmtpauth.c
+++ b/src/goabackend/goasmtpauth.c
@@ -220,11 +220,12 @@ smtp_auth_get_domain (GoaSmtpAuth *self,
GError **error)
{
GoaMail *mail;
- const gchar *email_address;
gchar *domain;
+ gchar *email_address;
mail = NULL;
domain = NULL;
+ email_address = NULL;
if (self->domain != NULL)
{
@@ -242,7 +243,7 @@ smtp_auth_get_domain (GoaSmtpAuth *self,
goto out;
}
- email_address = goa_mail_get_email_address (mail);
+ email_address = goa_mail_dup_email_address (mail);
if (!goa_utils_parse_email_address (email_address, NULL, &domain))
{
g_set_error (error,
@@ -263,6 +264,7 @@ smtp_auth_get_domain (GoaSmtpAuth *self,
out:
g_clear_object (&mail);
+ g_free (email_address);
return domain;
}
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 739c9cf..727c663 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -690,7 +690,7 @@ goa_utils_get_credentials (GoaProvider *provider,
GVariant *credentials = NULL;
GoaAccount *account = NULL;
gboolean ret = FALSE;
- const gchar *username;
+ gchar *username = NULL;
gchar *password = NULL;
credentials = goa_utils_lookup_credentials_sync (provider,
@@ -701,7 +701,7 @@ goa_utils_get_credentials (GoaProvider *provider,
goto out;
account = goa_object_get_account (object);
- username = goa_account_get_identity (account);
+ username = goa_account_dup_identity (account);
if (!g_variant_lookup (credentials, id, "s", &password))
{
@@ -712,7 +712,10 @@ goa_utils_get_credentials (GoaProvider *provider,
}
if (out_username)
- *out_username = g_strdup (username);
+ {
+ *out_username = username;
+ username = NULL;
+ }
if (out_password)
{
@@ -725,6 +728,7 @@ goa_utils_get_credentials (GoaProvider *provider,
out:
g_clear_object (&account);
g_clear_pointer (&credentials, (GDestroyNotify) g_variant_unref);
+ g_free (username);
g_free (password);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]