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



commit dcabd59c9dc23a51f46cbeebb01033d6e043d6f3
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]