[evolution-data-server/gnome-2-32] e_contact_name_from_string(): Fix possible memory leak



commit 6cabbd8201ed15d656b4bf6568e56473e636bcae
Author: Christophe Dumez <christophe dumez intel com>
Date:   Mon Jun 6 16:55:04 2011 +0300

    e_contact_name_from_string(): Fix possible memory leak
    
    The 'name' variable memory was leaked when name_str
    is NULL.
    
    (Adapted from commit 6f17fe55e43d366eebd7f0bc7eeba0f3c56b3785)

 addressbook/libebook/e-contact.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index 033694f..0a08304 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -1743,11 +1743,12 @@ e_contact_name_to_string(const EContactName *name)
 EContactName*
 e_contact_name_from_string (const gchar *name_str)
 {
-	EContactName *name = e_contact_name_new();
+	EContactName *name;
 	ENameWestern *western;
 
 	g_return_val_if_fail (name_str != NULL, NULL);
 
+	name = e_contact_name_new ();
 	western = e_name_western_parse (name_str ? name_str : "");
 
 	name->prefixes   = g_strdup (western->prefix);



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