[evolution-data-server/openismus-work: 5/7] Fixed double free.



commit 90f2f2e5355af43c10e54f1dbb5d91be3c180065
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Jun 12 18:49:21 2011 +0900

    Fixed double free.
    
    e_data_book_view_notify_update_prefiltered_vcard() and
    e_data_book_view_notify_update_vcard() both take ownership of the passed
    vcard string and free it later on. Make sure we give it a new string here.

 addressbook/backends/file/e-book-backend-file.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index af759f7..15c62df 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -557,16 +557,13 @@ notify_update_vcard (EDataBookView *book_view,
 		final_vcard = e_vcard_to_string (E_VCARD (shallow), EVC_FORMAT_VCARD_30);
 		g_object_unref (shallow);
 	} else {
-		final_vcard = (gchar *)vcard;
+		final_vcard = g_strdup (vcard);
 	}
 
 	if (prefiltered)
 		e_data_book_view_notify_update_prefiltered_vcard (book_view, id, final_vcard);
 	else
 		e_data_book_view_notify_update_vcard (book_view, final_vcard);
-
-	if (final_vcard != (gchar *)vcard)
-		g_free (final_vcard);
 }
 
 static gpointer



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