[evolution-data-server/gnome-3-0] e_book_backend_file_get_contact_list: Fix memory leak



commit 246fb4ca8d6836f97468c4a61e7a535ab771b805
Author: Christophe Dumez <christophe dumez intel com>
Date:   Mon Jun 6 16:48:42 2011 +0300

    e_book_backend_file_get_contact_list: Fix memory leak
    
    vcard_dbt.data should be freed if it is not appended to
    the contact list otherwise memory gets leaked.
    
    (Adapted from commit 4324e0125cbc23c81bd8f1dadcafdd945cf26eb1)

 addressbook/backends/file/e-book-backend-file.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index d977a2e..b2bd821 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -476,7 +476,11 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
 
 				if ((!search_needed) || (card_sexp != NULL && e_book_backend_sexp_match_vcard  (card_sexp, vcard_dbt.data))) {
 					contact_list = g_list_prepend (contact_list, vcard_dbt.data);
+				} else {
+					free (vcard_dbt.data);
 				}
+			} else {
+				free (vcard_dbt.data);
 			}
 
 			db_error = dbc->c_get (dbc, &id_dbt, &vcard_dbt, DB_NEXT);



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