Checked memory frees and added minor code fixes
[maevies] / test / mvs-minfo-provider-test.c
index 7f80c30..f05530d 100644 (file)
@@ -36,7 +36,7 @@ static GOptionEntry entries[] = {
 };
 
 static void
-response_received_callback (MvsMInfoProvider *minfo_provider, GList *list,
+response_received_cb (MvsMInfoProvider *minfo_provider, GList *list,
                             gpointer user_data)
 {
         GList *tmp = NULL;
@@ -72,18 +72,19 @@ main (int argc, char **argv)
 {
         MvsMInfoProvider *minfo_provider = NULL;
         GOptionContext *context = NULL;
-        GOptionGroup *gst_option_group = NULL;
         GError *error = NULL;
         MvsService service = MVS_SERVICE_TMDB;
 
         g_type_init ();
-
-        g_thread_init (NULL);
+        if (!g_thread_supported ())
+                g_thread_init (NULL);
 
         context = g_option_context_new (" - Tests data provider behavior");
         g_option_context_add_main_entries (context, entries, NULL);
         if (!g_option_context_parse (context, &argc, &argv, &error)) {
                 g_critical ("option parsing failed: %s", error->message);
+                g_error_free (error);
+                g_option_context_free (context);
                 return -1;
         }
 
@@ -94,7 +95,7 @@ main (int argc, char **argv)
 
         minfo_provider = mvs_minfo_provider_new ();
         g_signal_connect (minfo_provider, "response-received",
-                          G_CALLBACK (response_received_callback), NULL);
+                          G_CALLBACK (response_received_cb), NULL);
 
         loop = g_main_loop_new (NULL, FALSE);
 
@@ -102,8 +103,10 @@ main (int argc, char **argv)
                                   query);
 
         g_main_loop_run (loop);
+
         g_object_unref (minfo_provider);
         g_main_loop_unref (loop);
+        g_option_context_free (context);
 
         return 0;
 }