[grilo-plugins] youtube: Fix leak on two errors paths when querying categories



commit 4ef9c53cd2e00abbb0c993c34195e68413fd9d95
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Apr 29 17:48:03 2015 +0100

    youtube: Fix leak on two errors paths when querying categories
    
    When there was an error querying the categories, or when zero categories
    were returned, the BuildCategorySpec callback would not be called, and
    then the struct itself would not be freed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748395

 src/youtube/grl-youtube.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index 4f9f3be..7f06f89 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -606,7 +606,7 @@ build_categories_directory_read_cb (GObject *source_object,
 
   if (error != NULL) {
     g_error_free (error);
-    return;
+    goto done;
   }
 
   categories = gdata_app_categories_get_categories (app_categories);
@@ -638,10 +638,11 @@ build_categories_directory_read_cb (GObject *source_object,
       iter = g_list_next (iter);
     } while (iter);
     g_list_free (all);
-
-    bcs->callback (bcs);
-    g_slice_free (BuildCategorySpec, bcs);
   }
+
+done:
+  bcs->callback (bcs);
+  g_slice_free (BuildCategorySpec, bcs);
 }
 
 static gint


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