[grilo] Don't crash in grl_source_get_media_from_uri()



commit 90b7c9842eee77f601de01f2b1ac8abb817c1585
Author: Mathias Hasselmann <mathias openismus com>
Date:   Thu Aug 16 18:51:30 2012 +0200

    Don't crash in grl_source_get_media_from_uri()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682024

 src/grl-source.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/grl-source.c b/src/grl-source.c
index c1ab39d..0d4a708 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -1028,16 +1028,21 @@ resolve_relay_free (struct ResolveRelayCb *rrc)
   gpointer value;
 
   g_object_unref (rrc->source);
-  g_object_unref (rrc->media);
+  if (rrc->media)
+    g_object_unref (rrc->media);
   g_object_unref (rrc->options);
   g_list_free (rrc->keys);
 
-  g_hash_table_iter_init (&iter, rrc->map);
-  while (g_hash_table_iter_next (&iter, NULL, &value)) {
-    map_list_nodes_free ((GList *) value);
+  if (rrc->map) {
+    g_hash_table_iter_init (&iter, rrc->map);
+    while (g_hash_table_iter_next (&iter, NULL, &value)) {
+      map_list_nodes_free ((GList *) value);
+    }
+    g_hash_table_unref (rrc->map);
   }
-  g_hash_table_unref (rrc->map);
-  g_hash_table_unref (rrc->resolve_specs);
+
+  if (rrc->resolve_specs)
+    g_hash_table_unref (rrc->resolve_specs);
 
   g_slice_free (struct ResolveRelayCb, rrc);
 }
@@ -3322,7 +3327,7 @@ grl_source_get_media_from_uri (GrlSource *source,
   /* Always hook an own relay callback so we can do some
      post-processing before handing out the results
      to the user */
-  rrc = g_slice_new (struct ResolveRelayCb);
+  rrc = g_slice_new0 (struct ResolveRelayCb);
   rrc->source = g_object_ref (source);
   rrc->operation_type = GRL_OP_MEDIA_FROM_URI;
   rrc->operation_id = operation_id;



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