[gnome-online-accounts/wip/rishi/kerberos: 1/7] kerberos: Style fixes
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/kerberos: 1/7] kerberos: Style fixes
- Date: Sun, 14 Aug 2016 22:22:21 +0000 (UTC)
commit e0ed5539f6d1d7a5be0547fcdd0b505b56874679
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Aug 2 02:38:57 2016 +0200
kerberos: Style fixes
Let's follow the same error handling idiom as used in the rest of the
code.
It is good to use a GDestroyNotify with g_task_return_pointer because
the pointer won't be leaked if g_task_propagate_pointer is not called.
This brings the code more in line with what is expected from a
GAsyncResult-based API.
src/goabackend/goakerberosprovider.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index 50520f4..690e4eb 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -1613,7 +1613,7 @@ sign_in_thread (GTask *task,
const char *identifier;
const char *password;
const char *preauth_source;
- char *object_path;
+ char *object_path = NULL;
GError *error;
identifier = g_task_get_source_tag (task);
@@ -1624,9 +1624,16 @@ sign_in_thread (GTask *task,
object_path = sign_in_identity_sync (self, identifier, password, preauth_source, cancellable, &error);
if (object_path == NULL)
- g_task_return_error (task, error);
- else
- g_task_return_pointer (task, object_path, NULL);
+ {
+ g_task_return_error (task, error);
+ goto out;
+ }
+
+ g_task_return_pointer (task, object_path, g_free);
+ object_path = NULL;
+
+ out:
+ g_free (object_path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]