[gnome-online-accounts/wip/rishi/templates: 4/10] daemon: Consolidate exit paths & make the ref / unref more obvious



commit 0262052058e545fcde071f6006bea94cae0ff161
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 26 15:37:00 2016 +0200

    daemon: Consolidate exit paths & make the ref / unref more obvious

 src/daemon/goadaemon.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index ef81d85..62dcc84 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -476,8 +476,7 @@ add_config_file (GoaDaemon     *self,
                      error->message, g_quark_to_string (error->domain), error->code);
         }
       g_error_free (error);
-      g_key_file_unref (key_file);
-      return;
+      goto out;
     }
 
   guid = g_dbus_connection_get_guid (self->connection);
@@ -576,7 +575,10 @@ add_config_file (GoaDaemon     *self,
         }
     }
 
-  *key_files_to_free = g_list_prepend (*key_files_to_free, key_file);
+  *key_files_to_free = g_list_prepend (*key_files_to_free, g_key_file_ref (key_file));
+
+ out:
+  g_key_file_unref (key_file);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]