[grilo-plugins] vimeo: Fix accessing of freed memory during searches



commit 619160f344bbc355f3bed535aef43c800bb0db82
Author: Chris Lord <chris linux intel com>
Date:   Fri Sep 24 11:24:46 2010 +0100

    vimeo: Fix accessing of freed memory during searches
    
    When the callback in the search-data is called and there are no more
    results left, the callback frees the related data. This data is accessed
    beyond the callback though, so this needs to be guarded against.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630494

 src/vimeo/grl-vimeo.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index 268ff1c..ef4deda 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -251,6 +251,7 @@ search_cb (GVimeo *vimeo, GList *video_list, gpointer user_data)
 {
   GrlMedia *media = NULL;
   SearchData *sd = (SearchData *) user_data;
+  gint count = sd->ss->count;
   gchar *media_type;
 
   /* Go to offset element */
@@ -268,7 +269,7 @@ search_cb (GVimeo *vimeo, GList *video_list, gpointer user_data)
     return;
   }
 
-  while (video_list && sd->ss->count)
+  while (video_list && count)
   {
     media_type = g_hash_table_lookup (video_list->data, "title");
     if (media_type) {
@@ -286,12 +287,15 @@ search_cb (GVimeo *vimeo, GList *video_list, gpointer user_data)
 			NULL);
     }
     video_list = g_list_next (video_list);
-    sd->ss->count--;
+
+    if (--count)
+      sd->ss->count = count;
+
     media = NULL;
   }
 
   /* Get more elements */
-  if (sd->ss->count)
+  if (count)
   {
     sd->offset = 0;
     sd->page++;



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