gst/gsturi.c: Don't leak plugin feature.
authorTim-Philipp Müller <tim@centricular.net>
Fri, 11 May 2007 14:46:10 +0000 (14:46 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 11 May 2007 14:46:10 +0000 (14:46 +0000)
Original commit message from CVS:
* gst/gsturi.c: (gst_element_make_from_uri):
Don't leak plugin feature.
* tests/check/Makefile.am:
* tests/check/gst/.cvsignore:
* tests/check/gst/gsturi.c: (GST_START_TEST), (gst_uri_suite):
Add brain-dead unit test.

ChangeLog
gst/gsturi.c
tests/check/Makefile.am
tests/check/gst/.gitignore
tests/check/gst/gsturi.c [new file with mode: 0644]

index a681da1..db4f08f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2007-05-11  Tim-Philipp Müller  <tim at centricular dot net>
 
+       * gst/gsturi.c: (gst_element_make_from_uri):
+         Don't leak plugin feature.
+
+       * tests/check/Makefile.am:
+       * tests/check/gst/.cvsignore:
+       * tests/check/gst/gsturi.c: (GST_START_TEST), (gst_uri_suite):
+         Add brain-dead unit test.
+
+2007-05-11  Tim-Philipp Müller  <tim at centricular dot net>
+
        Patch by: Jeroen Wouters <woutersj at gmail com>
 
        * gst/gsturi.c: (gst_uri_get_protocol), (search_by_entry):
index b0a5554..8e5e2c3 100644 (file)
@@ -593,7 +593,7 @@ gst_element_make_from_uri (const GstURIType type, const gchar * uri,
     }
     walk = walk->next;
   }
-  g_list_free (possibilities);
+  gst_plugin_feature_list_free (possibilities);
 
   GST_LOG_OBJECT (ret, "created %s for URL '%s'",
       type == GST_URI_SINK ? "sink" : "source", uri);
index c01ca87..85fd8a8 100644 (file)
@@ -52,6 +52,7 @@ REGISTRY_CHECKS =                             \
        gst/gstplugin                           \
        gst/gstquery                            \
        gst/gstregistry                         \
+       gst/gsturi                              \
        gst/gstutils                            \
        generic/sinks                           \
        elements/fakesink                       \
index f3809f6..f6281bc 100644 (file)
@@ -22,6 +22,7 @@ gststructure
 gstsystemclock
 gsttag
 gsttagsetter
+gsturi
 gstutils
 gstvalue
 gstquery
diff --git a/tests/check/gst/gsturi.c b/tests/check/gst/gsturi.c
new file mode 100644 (file)
index 0000000..d54d9f4
--- /dev/null
@@ -0,0 +1,55 @@
+/* GStreamer unit tests for GstURI
+ *
+ * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gst/check/gstcheck.h>
+
+GST_START_TEST (test_protocol_case)
+{
+  GstElement *element;
+
+  element = gst_element_make_from_uri (GST_URI_SRC, "file:///foo/bar", NULL);
+
+  /* no element? probably no registry, bail out */
+  if (element == NULL)
+    return;
+
+  gst_object_unref (element);
+  element = gst_element_make_from_uri (GST_URI_SRC, "FILE:///foo/bar", NULL);
+  fail_unless (element != NULL,
+      "Got source for 'file://' URI but not for 'FILE://' URI");
+  gst_object_unref (element);
+}
+
+GST_END_TEST;
+
+static Suite *
+gst_uri_suite (void)
+{
+  Suite *s = suite_create ("GstURI");
+  TCase *tc_chain = tcase_create ("uri");
+
+  tcase_set_timeout (tc_chain, 20);
+
+  suite_add_tcase (s, tc_chain);
+  tcase_add_test (tc_chain, test_protocol_case);
+  return s;
+}
+
+GST_CHECK_MAIN (gst_uri);