tests/check/gst/gstghostpad.c: Fix some memory leaks and uses of object instances that we don't actually own.

Original commit message from CVS:
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix some memory leaks and uses of object instances that we don't
actually own.
This commit is contained in:
Sebastian Dröge 2008-06-24 07:49:36 +00:00
parent 15b694fc7a
commit 7c0bd009ce
2 changed files with 57 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2008-06-24 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix some memory leaks and uses of object instances that we don't
actually own.
2008-06-22 Thijs Vermeir <thijsvermeir@gmail.com> 2008-06-22 Thijs Vermeir <thijsvermeir@gmail.com>
* plugins/elements/gstmultiqueue.c: * plugins/elements/gstmultiqueue.c:

View file

@ -26,7 +26,9 @@
GST_START_TEST (test_remove1) GST_START_TEST (test_remove1)
{ {
GstElement *b1, *b2, *src, *sink; GstElement *b1, *b2, *src, *sink;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPadLinkReturn ret; GstPadLinkReturn ret;
b1 = gst_element_factory_make ("pipeline", NULL); b1 = gst_element_factory_make ("pipeline", NULL);
@ -78,7 +80,9 @@ GST_END_TEST;
GST_START_TEST (test_remove2) GST_START_TEST (test_remove2)
{ {
GstElement *b1, *b2, *src, *sink; GstElement *b1, *b2, *src, *sink;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPadLinkReturn ret; GstPadLinkReturn ret;
b1 = gst_element_factory_make ("pipeline", NULL); b1 = gst_element_factory_make ("pipeline", NULL);
@ -151,10 +155,15 @@ GST_END_TEST;
GST_START_TEST (test_ghost_pads_notarget) GST_START_TEST (test_ghost_pads_notarget)
{ {
GstElement *b1, *b2, *sink; GstElement *b1, *b2, *sink;
GstPad *srcpad, *sinkpad, *peer; GstPad *srcpad, *sinkpad, *peer;
GstPadLinkReturn ret; GstPadLinkReturn ret;
gboolean bret; gboolean bret;
GstBus *bus; GstBus *bus;
GstCaps *caps; GstCaps *caps;
b1 = gst_element_factory_make ("pipeline", NULL); b1 = gst_element_factory_make ("pipeline", NULL);
@ -214,7 +223,9 @@ GST_END_TEST;
GST_START_TEST (test_link) GST_START_TEST (test_link)
{ {
GstElement *b1, *b2, *src, *sink; GstElement *b1, *b2, *src, *sink;
GstPad *srcpad, *sinkpad, *gpad; GstPad *srcpad, *sinkpad, *gpad;
GstPadLinkReturn ret; GstPadLinkReturn ret;
b1 = gst_element_factory_make ("pipeline", NULL); b1 = gst_element_factory_make ("pipeline", NULL);
@ -269,7 +280,9 @@ GST_END_TEST;
GST_START_TEST (test_ghost_pads) GST_START_TEST (test_ghost_pads)
{ {
GstElement *b1, *b2, *src, *i1, *sink; GstElement *b1, *b2, *src, *i1, *sink;
GstPad *gsink, *gsrc, *gisrc, *gisink, *isink, *isrc, *fsrc, *fsink; GstPad *gsink, *gsrc, *gisrc, *gisink, *isink, *isrc, *fsrc, *fsink;
GstStateChangeReturn ret; GstStateChangeReturn ret;
b1 = gst_element_factory_make ("pipeline", NULL); b1 = gst_element_factory_make ("pipeline", NULL);
@ -373,11 +386,17 @@ GST_END_TEST;
GST_START_TEST (test_ghost_pads_bin) GST_START_TEST (test_ghost_pads_bin)
{ {
GstBin *pipeline; GstBin *pipeline;
GstBin *srcbin; GstBin *srcbin;
GstBin *sinkbin; GstBin *sinkbin;
GstElement *src; GstElement *src;
GstElement *sink; GstElement *sink;
GstPad *srcpad, *srcghost, *target; GstPad *srcpad, *srcghost, *target;
GstPad *sinkpad, *sinkghost; GstPad *sinkpad, *sinkghost;
pipeline = GST_BIN (gst_pipeline_new ("pipe")); pipeline = GST_BIN (gst_pipeline_new ("pipe"));
@ -443,10 +462,15 @@ block_callback (GstPad * pad, gboolean blocked, gpointer user_data)
GST_START_TEST (test_ghost_pads_block) GST_START_TEST (test_ghost_pads_block)
{ {
GstBin *pipeline; GstBin *pipeline;
GstBin *srcbin; GstBin *srcbin;
GstElement *src; GstElement *src;
GstPad *srcpad; GstPad *srcpad;
GstPad *srcghost; GstPad *srcghost;
BlockData block_data; BlockData block_data;
pipeline = GST_BIN (gst_pipeline_new ("pipeline")); pipeline = GST_BIN (gst_pipeline_new ("pipeline"));
@ -484,10 +508,15 @@ GST_END_TEST;
GST_START_TEST (test_ghost_pads_probes) GST_START_TEST (test_ghost_pads_probes)
{ {
GstBin *pipeline; GstBin *pipeline;
GstBin *srcbin; GstBin *srcbin;
GstElement *src; GstElement *src;
GstPad *srcpad; GstPad *srcpad;
GstPad *srcghost; GstPad *srcghost;
BlockData block_data; BlockData block_data;
pipeline = GST_BIN (gst_pipeline_new ("pipeline")); pipeline = GST_BIN (gst_pipeline_new ("pipeline"));
@ -525,7 +554,9 @@ GST_END_TEST;
GST_START_TEST (test_ghost_pads_new_from_template) GST_START_TEST (test_ghost_pads_new_from_template)
{ {
GstPad *sinkpad, *ghostpad; GstPad *sinkpad, *ghostpad;
GstPadTemplate *padtempl, *ghosttempl; GstPadTemplate *padtempl, *ghosttempl;
GstCaps *padcaps, *ghostcaps, *newcaps; GstCaps *padcaps, *ghostcaps, *newcaps;
padcaps = gst_caps_from_string ("some/caps"); padcaps = gst_caps_from_string ("some/caps");
@ -534,7 +565,7 @@ GST_START_TEST (test_ghost_pads_new_from_template)
fail_unless (ghostcaps != NULL); fail_unless (ghostcaps != NULL);
padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK, padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK,
GST_PAD_ALWAYS, padcaps); GST_PAD_ALWAYS, gst_caps_copy (padcaps));
fail_unless (padtempl != NULL); fail_unless (padtempl != NULL);
ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK, ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK,
GST_PAD_ALWAYS, ghostcaps); GST_PAD_ALWAYS, ghostcaps);
@ -554,6 +585,12 @@ GST_START_TEST (test_ghost_pads_new_from_template)
fail_unless (gst_caps_is_equal (newcaps, padcaps)); fail_unless (gst_caps_is_equal (newcaps, padcaps));
gst_caps_unref (newcaps); gst_caps_unref (newcaps);
gst_caps_unref (padcaps); gst_caps_unref (padcaps);
gst_object_unref (sinkpad);
gst_object_unref (ghostpad);
gst_object_unref (padtempl);
gst_object_unref (ghosttempl);
} }
GST_END_TEST; GST_END_TEST;
@ -561,7 +598,9 @@ GST_END_TEST;
GST_START_TEST (test_ghost_pads_new_no_target_from_template) GST_START_TEST (test_ghost_pads_new_no_target_from_template)
{ {
GstPad *sinkpad, *ghostpad; GstPad *sinkpad, *ghostpad;
GstPadTemplate *padtempl, *ghosttempl; GstPadTemplate *padtempl, *ghosttempl;
GstCaps *padcaps, *ghostcaps, *newcaps; GstCaps *padcaps, *ghostcaps, *newcaps;
padcaps = gst_caps_from_string ("some/caps"); padcaps = gst_caps_from_string ("some/caps");
@ -570,10 +609,10 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
fail_unless (ghostcaps != NULL); fail_unless (ghostcaps != NULL);
padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK, padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK,
GST_PAD_ALWAYS, padcaps); GST_PAD_ALWAYS, gst_caps_copy (padcaps));
fail_unless (padtempl != NULL); fail_unless (padtempl != NULL);
ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK, ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK,
GST_PAD_ALWAYS, ghostcaps); GST_PAD_ALWAYS, gst_caps_copy (ghostcaps));
sinkpad = gst_pad_new_from_template (padtempl, "sinkpad"); sinkpad = gst_pad_new_from_template (padtempl, "sinkpad");
fail_unless (sinkpad != NULL); fail_unless (sinkpad != NULL);
@ -598,6 +637,14 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
fail_unless (gst_caps_is_equal (newcaps, padcaps)); fail_unless (gst_caps_is_equal (newcaps, padcaps));
gst_caps_unref (newcaps); gst_caps_unref (newcaps);
gst_object_unref (sinkpad);
gst_object_unref (ghostpad);
gst_object_unref (padtempl);
gst_object_unref (ghosttempl);
gst_caps_unref (padcaps);
gst_caps_unref (ghostcaps);
} }
GST_END_TEST; GST_END_TEST;
@ -606,6 +653,7 @@ static Suite *
gst_ghost_pad_suite (void) gst_ghost_pad_suite (void)
{ {
Suite *s = suite_create ("GstGhostPad"); Suite *s = suite_create ("GstGhostPad");
TCase *tc_chain = tcase_create ("ghost pad tests"); TCase *tc_chain = tcase_create ("ghost pad tests");
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);