[gnome-documents/wip/facebook] facebook miner: Better management of the photo list in an album, reeing memory at the end



commit 7b336d5cd986329b86adb9766d4a37e82fc738e9
Author: Álvaro Peña <alvaropg gmail com>
Date:   Wed Jun 5 17:14:21 2013 +0200

    facebook miner: Better management of the photo list in an album, reeing memory at the end

 src/miner/gd-facebook-miner.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/miner/gd-facebook-miner.c b/src/miner/gd-facebook-miner.c
index ae85705..72c5209 100644
--- a/src/miner/gd-facebook-miner.c
+++ b/src/miner/gd-facebook-miner.c
@@ -143,6 +143,7 @@ account_miner_job_lookup_album (GdAccountMinerJob *job, GFBGraphAlbum *album, co
   gboolean resource_exists;
   gchar *contact_resource;
   GList *photos = NULL;
+  GList *photo_iter = NULL;
 
   album_id = gfbgraph_node_get_id (GFBGRAPH_NODE (album));
   album_link = gfbgraph_node_get_link (GFBGRAPH_NODE (album));
@@ -226,13 +227,14 @@ account_miner_job_lookup_album (GdAccountMinerJob *job, GFBGraphAlbum *album, co
   if (*error != NULL)
     goto out;
 
-  while (photos) {
+  photo_iter = photos;
+  while (photo_iter) {
     GFBGraphPhoto *photo;
 
-    photo = GFBGRAPH_PHOTO (photos->data);
+    photo = GFBGRAPH_PHOTO (photo_iter->data);
     account_miner_job_process_photo (job, photo, (const gchar*) identifier, creator, error);
 
-    photos = g_list_next (photos);
+    photo_iter = g_list_next (photo_iter);
   }
 
  out:
@@ -241,6 +243,9 @@ account_miner_job_lookup_album (GdAccountMinerJob *job, GFBGraphAlbum *album, co
   g_free (identifier);
   g_free (resource);
 
+  if (photos != NULL)
+    g_list_free_full (photos, g_object_unref);
+
   if (*error != NULL)
     return FALSE;
 


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