[evolution-data-server/email-factory] e_book_backend_file_get_contact_list: Fix memory leak



commit dedce80ee18c498c560f95affcaea1fabb2eb5af
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 eceb7bc..1b7c7d7 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]