[gnome-online-accounts/gnome-3-18] smtp-auth: Plug leaks in error handling



commit d370f231cb37735403fa698d3203b6b97d80a282
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Nov 19 18:54:18 2015 +0100

    smtp-auth: Plug leaks in error handling
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758361

 src/goabackend/goasmtpauth.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/goabackend/goasmtpauth.c b/src/goabackend/goasmtpauth.c
index 96950a9..a736435 100644
--- a/src/goabackend/goasmtpauth.c
+++ b/src/goabackend/goasmtpauth.c
@@ -219,9 +219,13 @@ static gchar *
 smtp_auth_get_domain (GoaSmtpAuth   *self,
                       GError       **error)
 {
+  GoaMail *mail;
   gchar *domain;
+  gchar *email_address;
 
+  mail = NULL;
   domain = NULL;
+  email_address = NULL;
 
   if (self->domain != NULL)
     {
@@ -229,9 +233,6 @@ smtp_auth_get_domain (GoaSmtpAuth   *self,
     }
   else if (self->object != NULL)
     {
-      GoaMail *mail;
-      gchar *email_address;
-
       mail = goa_object_get_mail (self->object);
       if (mail == NULL)
         {
@@ -251,9 +252,6 @@ smtp_auth_get_domain (GoaSmtpAuth   *self,
                        _("Failed to parse email address"));
           goto out;
         }
-
-      g_free (email_address);
-      g_object_unref (mail);
     }
   else
     {
@@ -265,6 +263,8 @@ smtp_auth_get_domain (GoaSmtpAuth   *self,
     }
 
  out:
+  g_clear_object (&mail);
+  g_free (email_address);
   return domain;
 }
 


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