From: Thibault Saunier Date: Tue, 9 Apr 2019 12:58:24 +0000 (-0400) Subject: tests: Plug misc leaks X-Git-Tag: 1.19.3~493^2~519 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86ac3b3159f9aba2689503f1fcf46f950cf07208;p=platform%2Fupstream%2Fgstreamer.git tests: Plug misc leaks --- diff --git a/tests/check/ges/clip.c b/tests/check/ges/clip.c index 6b1ce79..0720840 100644 --- a/tests/check/ges/clip.c +++ b/tests/check/ges/clip.c @@ -115,6 +115,7 @@ GST_START_TEST (test_split_direct_bindings) GstTimedValueControlSource *splitsource; GESLayer *layer; GESAsset *asset; + GValue *tmpvalue; GESTrackElement *element; @@ -129,6 +130,7 @@ GST_START_TEST (test_split_direct_bindings) asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL); clip = ges_layer_add_asset (layer, asset, 0, 10 * GST_SECOND, 10 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN); + g_object_unref (asset); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 10 * GST_SECOND); assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1); @@ -146,10 +148,15 @@ GST_START_TEST (test_split_direct_bindings) 20 * GST_SECOND, 1.0); binding = ges_track_element_get_control_binding (element, "alpha"); - assert_equals_int (g_value_get_double (gst_control_binding_get_value (binding, - 10 * GST_SECOND)), 0.0); - assert_equals_int (g_value_get_double (gst_control_binding_get_value (binding, - 20 * GST_SECOND)), 1.0); + tmpvalue = gst_control_binding_get_value (binding, 10 * GST_SECOND); + assert_equals_int (g_value_get_double (tmpvalue), 0.0); + g_value_unset (tmpvalue); + g_free (tmpvalue); + + tmpvalue = gst_control_binding_get_value (binding, 20 * GST_SECOND); + assert_equals_int (g_value_get_double (tmpvalue), 1.0); + g_value_unset (tmpvalue); + g_free (tmpvalue); splitclip = ges_clip_split (clip, 5 * GST_SECOND); CHECK_OBJECT_PROPS (splitclip, 5 * GST_SECOND, 15 * GST_SECOND, @@ -172,6 +179,7 @@ GST_START_TEST (test_split_direct_bindings) assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, 20 * GST_SECOND); assert_equals_float (((GstTimedValue *) values->next->data)->value, 1.0); + g_list_free (values); values = gst_timed_value_control_source_get_all (GST_TIMED_VALUE_CONTROL_SOURCE @@ -184,6 +192,7 @@ GST_START_TEST (test_split_direct_bindings) assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, 15 * GST_SECOND); assert_equals_float (((GstTimedValue *) values->next->data)->value, 0.50); + g_list_free (values); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 5 * GST_SECOND); check_layer (clip, 0); @@ -204,6 +213,7 @@ GST_START_TEST (test_split_direct_absolute_bindings) GstTimedValueControlSource *splitsource; GESLayer *layer; GESAsset *asset; + GValue *tmpvalue; GESTrackElement *element; @@ -218,6 +228,7 @@ GST_START_TEST (test_split_direct_absolute_bindings) asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL); clip = ges_layer_add_asset (layer, asset, 0, 10 * GST_SECOND, 10 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN); + g_object_unref (asset); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 10 * GST_SECOND); assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1); @@ -235,10 +246,15 @@ GST_START_TEST (test_split_direct_absolute_bindings) 20 * GST_SECOND, 500); binding = ges_track_element_get_control_binding (element, "posx"); - assert_equals_int (g_value_get_int (gst_control_binding_get_value (binding, - 10 * GST_SECOND)), 0); - assert_equals_int (g_value_get_int (gst_control_binding_get_value (binding, - 20 * GST_SECOND)), 500); + tmpvalue = gst_control_binding_get_value (binding, 10 * GST_SECOND); + assert_equals_int (g_value_get_int (tmpvalue), 0); + g_value_unset (tmpvalue); + g_free (tmpvalue); + + tmpvalue = gst_control_binding_get_value (binding, 20 * GST_SECOND); + assert_equals_int (g_value_get_int (tmpvalue), 500); + g_value_unset (tmpvalue); + g_free (tmpvalue); splitclip = ges_clip_split (clip, 5 * GST_SECOND); CHECK_OBJECT_PROPS (splitclip, 5 * GST_SECOND, 15 * GST_SECOND, @@ -261,6 +277,7 @@ GST_START_TEST (test_split_direct_absolute_bindings) assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, 20 * GST_SECOND); assert_equals_float (((GstTimedValue *) values->next->data)->value, 500.0); + g_list_free (values); values = gst_timed_value_control_source_get_all (GST_TIMED_VALUE_CONTROL_SOURCE @@ -273,6 +290,7 @@ GST_START_TEST (test_split_direct_absolute_bindings) assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, 15 * GST_SECOND); assert_equals_float (((GstTimedValue *) values->next->data)->value, 250.0); + g_list_free (values); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 5 * GST_SECOND); check_layer (clip, 0); diff --git a/tests/check/ges/group.c b/tests/check/ges/group.c index aa24646..edbd911 100644 --- a/tests/check/ges/group.c +++ b/tests/check/ges/group.c @@ -582,6 +582,7 @@ GST_START_TEST (test_group_in_self) GES_TIMELINE_ELEMENT (group))); clips = ges_container_get_children (GES_CONTAINER (group), TRUE); assert_equals_int (g_list_length (clips), 6); + g_list_free_full (clips, g_object_unref); gst_object_unref (timeline); gst_object_unref (asset); @@ -666,12 +667,13 @@ GST_START_TEST (test_group_serialization) fail_unless (timeline != NULL); layer = timeline->layers->data; - for (tmp = ges_layer_get_clips (layer); tmp; tmp = tmp->next) { + clips = ges_layer_get_clips (layer); + for (tmp = clips; tmp; tmp = tmp->next) { fail_unless (GES_IS_GROUP (GES_TIMELINE_ELEMENT_PARENT (tmp->data)), "%s parent is %p, NOT a group", GES_TIMELINE_ELEMENT_NAME (tmp->data), GES_TIMELINE_ELEMENT_PARENT (tmp->data)); } - + g_list_free_full (clips, g_object_unref); g_free (tmpuri); gst_object_unref (timeline); diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c index 8b36fac..c2ab229 100644 --- a/tests/check/ges/layer.c +++ b/tests/check/ges/layer.c @@ -1005,6 +1005,7 @@ GST_START_TEST (test_layer_activate_automatic_transition) transition = GES_CLIP (ges_layer_add_asset (layer, transition_asset, 1000, 0, 500, GES_TRACK_TYPE_VIDEO)); + g_object_unref (transition_asset); fail_unless (GES_IS_TRANSITION_CLIP (transition)); objects = GES_CONTAINER_CHILDREN (transition); assert_equals_int (g_list_length (objects), 1); diff --git a/tests/check/ges/mixers.c b/tests/check/ges/mixers.c index 27f08cb..15f7a4c 100644 --- a/tests/check/ges/mixers.c +++ b/tests/check/ges/mixers.c @@ -51,6 +51,7 @@ GST_START_TEST (simple_smart_adder_test) template, NULL, NULL); fail_unless (GST_IS_PAD (requested_pad)); + gst_object_unref (requested_pad); gst_object_unref (smart_adder); gst_object_unref (track); @@ -120,6 +121,7 @@ GST_START_TEST (simple_audio_mixed_with_pipeline) tmpclip = ges_layer_add_asset (layer1, asset, 0, 0, 2 * GST_SECOND, GES_TRACK_TYPE_AUDIO); + g_object_unref (asset); ges_audio_test_source_set_volume (GES_CONTAINER_CHILDREN (tmpclip)->data, 1); @@ -190,6 +192,7 @@ GST_START_TEST (audio_video_mixed_with_pipeline) tmpclip = ges_layer_add_asset (layer1, asset, 1 * GST_SECOND, 0, 5 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN); + g_object_unref (asset); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); main_loop = g_main_loop_new (NULL, FALSE); diff --git a/tests/check/ges/project.c b/tests/check/ges/project.c index d1c0358..5228613 100644 --- a/tests/check/ges/project.c +++ b/tests/check/ges/project.c @@ -342,9 +342,8 @@ _add_properties (GESTimeline * timeline) (source), 5 * GST_SECOND, 0.); gst_timed_value_control_source_set (GST_TIMED_VALUE_CONTROL_SOURCE (source), 10 * GST_SECOND, 1.); - } - /* Adding children properties */ - else if (GES_IS_VIDEO_SOURCE (element)) { + } else if (GES_IS_VIDEO_SOURCE (element)) { + /* Adding children properties */ gint64 posx = 42; ges_timeline_element_set_child_properties (GES_TIMELINE_ELEMENT (element), "posx", posx, NULL); @@ -358,6 +357,8 @@ _add_properties (GESTimeline * timeline) break; } } + + g_list_free_full (tracks, g_object_unref); } static void @@ -418,25 +419,27 @@ _check_properties (GESTimeline * timeline) fail_unless_equals_int64 (posx, 42); } } + g_list_free_full (track_elements, g_object_unref); break; default: break; } } + + g_list_free_full (tracks, g_object_unref); } GST_START_TEST (test_project_add_properties) { GESProject *project; GESTimeline *timeline; - GESAsset *formatter_asset; - gboolean saved; gchar *uri; ges_init (); uri = ges_test_file_uri ("test-properties.xges"); project = ges_project_new (uri); + g_free (uri); mainloop = g_main_loop_new (NULL, FALSE); /* Connect the signals */ @@ -451,20 +454,16 @@ GST_START_TEST (test_project_add_properties) GST_LOG ("Test first loading"); - g_free (uri); _add_properties (timeline); uri = ges_test_get_tmp_uri ("test-properties-save.xges"); - formatter_asset = ges_asset_request (GES_TYPE_FORMATTER, "ges", NULL); - saved = - ges_project_save (project, timeline, uri, formatter_asset, TRUE, NULL); - fail_unless (saved); - + fail_unless (ges_project_save (project, timeline, uri, NULL, TRUE, NULL)); gst_object_unref (timeline); gst_object_unref (project); project = ges_project_new (uri); + g_free (uri); ASSERT_OBJECT_REFCOUNT (project, "Our + cache", 2); @@ -480,7 +479,6 @@ GST_START_TEST (test_project_add_properties) gst_object_unref (timeline); gst_object_unref (project); - g_free (uri); g_main_loop_unref (mainloop); g_signal_handlers_disconnect_by_func (project, (GCallback) project_loaded_cb, @@ -500,6 +498,7 @@ GST_START_TEST (test_project_load_xges) GESTimeline *timeline; GESAsset *formatter_asset; gchar *uri; + GList *tmp; ges_init (); @@ -523,8 +522,9 @@ GST_START_TEST (test_project_load_xges) timeline = GES_TIMELINE (ges_asset_extract (GES_ASSET (loaded_project), NULL)); fail_unless (GES_IS_TIMELINE (timeline)); - assert_equals_int (g_list_length (ges_project_get_loading_assets - (loaded_project)), 1); + tmp = ges_project_get_loading_assets (loaded_project); + assert_equals_int (g_list_length (tmp), 1); + g_list_free_full (tmp, g_object_unref); g_main_loop_run (mainloop); GST_LOG ("Test first loading"); @@ -578,7 +578,7 @@ GST_END_TEST; GST_START_TEST (test_project_auto_transition) { - GList *layers; + GList *layers, *tmp; GESProject *project; GESTimeline *timeline; GESLayer *layer = NULL; @@ -606,8 +606,8 @@ GST_START_TEST (test_project_auto_transition) /* Check timeline and layers auto-transition, must be FALSE */ fail_if (ges_timeline_get_auto_transition (timeline)); layers = ges_timeline_get_layers (timeline); - for (; layers; layers = layers->next) { - layer = layers->data; + for (tmp = layers; tmp; tmp = tmp->next) { + layer = tmp->data; fail_if (ges_layer_get_auto_transition (layer)); } @@ -641,8 +641,8 @@ GST_START_TEST (test_project_auto_transition) /* Check timeline and layers auto-transition, must be TRUE */ fail_unless (ges_timeline_get_auto_transition (timeline)); layers = ges_timeline_get_layers (timeline); - for (; layers; layers = layers->next) { - layer = layers->data; + for (tmp = layers; tmp; tmp = tmp->next) { + layer = tmp->data; fail_unless (ges_layer_get_auto_transition (layer)); } diff --git a/tests/check/ges/timelineedition.c b/tests/check/ges/timelineedition.c index 8625780..3cab417 100644 --- a/tests/check/ges/timelineedition.c +++ b/tests/check/ges/timelineedition.c @@ -84,6 +84,7 @@ GST_START_TEST (test_basic_timeline_edition) clip2 = GES_CONTAINER (ges_layer_add_asset (layer, asset, 50, 0, 60, GES_TRACK_TYPE_UNKNOWN)); + g_object_unref (asset); trackelement2 = GES_CONTAINER_CHILDREN (clip2)->data; fail_unless (GES_IS_TRACK_ELEMENT (trackelement2)); @@ -436,7 +437,7 @@ asset_added_cb (GESProject * project, GESAsset * asset, void *mainloop) GST_START_TEST (test_simple_triming) { - GList *assets; + GList *assets, *tmp; GMainLoop *mainloop; GESClipAsset *asset; GESProject *project; @@ -472,13 +473,16 @@ GST_START_TEST (test_simple_triming) ges_layer_add_asset (layer, GES_ASSET (asset), 0, 0, 10, ges_clip_asset_get_supported_formats (asset)); + g_list_free_full (assets, g_object_unref); - element = ges_layer_get_clips (layer)->data; + tmp = ges_layer_get_clips (layer); + element = tmp->data; DEEP_CHECK (element, 0, 0, 10); ges_container_edit (GES_CONTAINER (element), NULL, -1, GES_EDIT_MODE_TRIM, GES_EDGE_START, 5); DEEP_CHECK (element, 5, 5, 5); + g_list_free_full (tmp, g_object_unref); g_main_loop_unref (mainloop); gst_object_unref (timeline); @@ -1229,6 +1233,7 @@ GST_START_TEST (test_scaling) ges_layer_add_asset (layer, GES_ASSET (asset1), 0 * GST_SECOND, 0 * GST_SECOND, 4 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN); gst_object_unref (asset1); + gst_object_unref (asset2); g_object_set (clip, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_SMPTE75, NULL); /** @@ -1382,6 +1387,7 @@ GST_START_TEST (test_scaling) * are changing the aspect ratio, the video should thus not be rescaled. */ caps = gst_caps_from_string ("video/x-raw,height=1080,width=1920"); ges_track_set_restriction_caps (trackv, caps); + gst_caps_unref (caps); fail_unless (check_frame_positioner_size (clip, 320, 240)); gst_object_unref (timeline);