>From d5148181a7bdc41bae9e70a294f1cea649659586 Mon Sep 17 00:00:00 2001
From: Christophe Dumez <christophe.dumez@intel.com>
Date: Tue, 17 May 2011 10:56:00 +0300
Subject: [PATCH 1/2] QContactEBook::initAddressBook() Fix memory leak

The list elements should be freed according to the
documentation for e_book_get_supported_fields().
---
 engine/qcontactebook.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/engine/qcontactebook.cpp b/engine/qcontactebook.cpp
index d99fa68..a5469d3 100644
--- a/engine/qcontactebook.cpp
+++ b/engine/qcontactebook.cpp
@@ -354,13 +354,12 @@ void QContactEBook::initAddressBook(const QMap<QString, QString>& parameters){
 
   //TEST Lists supported fields
   if (QCM5_DEBUG_ENABLED){
-    GList *l;
+    GList *l, *elem;
     e_book_get_supported_fields (m_ebook, &l, NULL);
-    while (l) {
-      qDebug() << "SUPPORTED FIELD" << (const char*)l->data;
-      l = l->next;
+    for(elem = l; elem; elem = elem->next) {
+      qDebug() << "SUPPORTED FIELD" << CONST_CHAR(elem->data);
     }
-    g_list_free(l);
+    g_list_free_full(l, free);
   }
 }
 
-- 
1.7.4.4

