[evolution-ews/gnome-3-20] Fix a memory leak when creating a contact



commit ef086557659a132229b4d772a0177be94a71bd44
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 31 15:15:31 2016 +0200

    Fix a memory leak when creating a contact

 src/addressbook/e-book-backend-ews.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 5115e7f..e6579a8 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -1382,12 +1382,13 @@ convert_contact_to_xml (ESoapMessage *msg,
                element_type = mappings[i].element_type;
 
                if (element_type == ELEMENT_TYPE_SIMPLE) {
-                       gchar *val = e_contact_get (contact, mappings[i].field_id);
+                       gchar *val;
 
                        /* skip uid while creating contacts */
                        if (mappings[i].field_id == E_CONTACT_UID)
                                continue;
 
+                       val = e_contact_get (contact, mappings[i].field_id);
                        if (val && *val)
                                e_ews_message_write_string_parameter (msg, mappings[i].element_name, NULL, 
val);
                        g_free (val);


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