[evolution-data-server] e_contact_name_from_string(): Fix possible memory leak



commit 6f17fe55e43d366eebd7f0bc7eeba0f3c56b3785
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.

 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 294ac8e..f486eb5 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -1744,11 +1744,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]