ges: Plug some leaks

This commit is contained in:
Thibault Saunier 2020-03-09 15:38:58 -03:00
parent ae6124e282
commit dcb3ad620d
8 changed files with 29 additions and 9 deletions

View file

@ -367,7 +367,7 @@ gboolean
_ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure,
GError ** error)
{
GESAsset *asset;
GESAsset *asset = NULL;
GESLayer *layer;
GESClip *clip;
gint layer_priority;
@ -546,6 +546,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure,
res = _ges_save_timeline_if_needed (timeline, structure, error);
beach:
gst_clear_object (&asset);
g_free (asset_id);
g_free (check_asset_id);
return res;
@ -555,7 +556,7 @@ gboolean
_ges_container_add_child_from_struct (GESTimeline * timeline,
GstStructure * structure, GError ** error)
{
GESAsset *asset;
GESAsset *asset = NULL;
GESContainer *container;
GESTimelineElement *child = NULL;
const gchar *container_name, *child_name, *child_type, *id;
@ -640,6 +641,7 @@ _ges_container_add_child_from_struct (GESTimeline * timeline,
res = _ges_save_timeline_if_needed (timeline, structure, error);
beach:
gst_clear_object (&asset);
return res;
}

View file

@ -1028,6 +1028,9 @@ timeline_get_framerate (GESTimeline * self, gint * fps_n, gint * fps_d)
GstCaps *restriction = ges_track_get_restriction_caps (tmp->data);
gint i;
if (!restriction)
continue;
for (i = 0; i < gst_caps_get_size (restriction); i++) {
gint n, d;

View file

@ -919,6 +919,8 @@ _ges_uri_asset_cleanup (void)
g_hash_table_destroy (discoverers);
discoverers = NULL;
}
gst_clear_object (&GES_URI_CLIP_ASSET_CLASS (g_type_class_peek
(GES_TYPE_URI_CLIP_ASSET))->discoverer);
G_UNLOCK (discoverers_lock);
}
@ -946,7 +948,7 @@ _ges_uri_asset_ensure_setup (gpointer uriasset_class)
if (errno)
timeout = DEFAULT_DISCOVERY_TIMEOUT;
if (!discoverer) {
if (!klass->discoverer) {
discoverer = gst_discoverer_new (timeout, &err);
if (!discoverer) {
GST_ERROR ("Could not create discoverer: %s", err->message);

View file

@ -234,7 +234,7 @@ _add_asset (GstValidateScenario * scenario, GstValidateAction * action)
const gchar *id = NULL;
const gchar *type_string = NULL;
GType type;
GESAsset *asset;
GESAsset *asset = NULL;
gboolean res = FALSE;
GESProject *project;
DECLARE_AND_GET_TIMELINE (scenario, action);
@ -269,6 +269,7 @@ _add_asset (GstValidateScenario * scenario, GstValidateAction * action)
SAVE_TIMELINE_IF_NEEDED (scenario, timeline, action);
beach:
gst_clear_object (&asset);
g_object_unref (timeline);
return res;
}
@ -544,12 +545,15 @@ _commit (GstValidateScenario * scenario, GstValidateAction * action)
action);
gst_object_unref (timeline);
gst_object_unref (bus);
gst_object_unref (pipeline);
return TRUE;
}
SAVE_TIMELINE_IF_NEEDED (scenario, timeline, action);
gst_object_unref (bus);
gst_object_unref (timeline);
SAVE_TIMELINE_IF_NEEDED (scenario, timeline, action);
gst_object_unref (pipeline);
return GST_VALIDATE_EXECUTE_ACTION_ASYNC;
}
@ -1170,6 +1174,7 @@ _load_project (GstValidateScenario * scenario, GstValidateAction * action)
gst_element_set_state (pipeline, state);
done:
gst_object_unref (pipeline);
if (error)
g_error_free (error);

View file

@ -79,10 +79,17 @@ if gstvalidate_dep.found()
'check_edit_in_frames_with_framerate_mismatch',
]
env = environment()
env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
env.set('GST_STATE_IGNORE_ELEMENTS', '')
env.set('CK_DEFAULT_TIMEOUT', '20')
env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), 'scenarios'))
env.set('GST_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
foreach scenario: scenarios
scenario_file = join_paths(meson.current_source_dir(), 'scenarios', scenario + '.scenario')
test(scenario, ges_launch, env: env, args: ['--set-scenario', scenario_file])
endforeach
test('simple_playback_test', ges_launch, env: env, args: ['+test-clip', 'blue', 'd=0.1', '--disable-validate', '--videosink=fakevideosink', '--audiosink=fakesink'])
endif
if build_gir

View file

@ -38,6 +38,7 @@ main (int argc, gchar ** argv)
ret = ges_launcher_get_exit_status (launcher);
g_object_unref (launcher);
ges_deinit ();
gst_deinit ();
return ret;

View file

@ -262,6 +262,7 @@ _create_timeline (GESLauncher * self, const gchar * serialized_timeline,
self->priv->timeline =
GES_TIMELINE (ges_asset_extract (GES_ASSET (project), &error));
gst_object_unref (project);
if (error) {
printerr ("\nERROR: Could not create timeline because: %s\n\n",

View file

@ -174,11 +174,10 @@ ges_validate_clean (GstPipeline * pipeline)
res = gst_validate_runner_exit (runner, TRUE);
gst_object_unref (pipeline);
if (runner) {
if (runner)
gst_object_unref (runner);
if (monitor)
gst_object_unref (monitor);
}
if (monitor)
gst_object_unref (monitor);
return res;
}