From af3006dc128a4c65bb025dc3c0be15c7e780766e Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 4 May 2020 16:59:54 -0400 Subject: [PATCH] validate: Plug some leaks Part-of: --- validate/gst/validate/gst-validate-scenario.c | 5 +++-- validate/gst/validate/validate.c | 5 ++++- validate/launcher/baseclasses.py | 2 +- validate/tools/gst-validate.c | 5 +++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 6bcab93..edfd155 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -553,8 +553,6 @@ gst_validate_action_type_new (void) gst_validate_action_type_init (type); - /* action types are never freed */ - GST_MINI_OBJECT_FLAG_SET (type, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED); return type; } @@ -3304,6 +3302,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action) action->repeat, NULL); done: + gst_clear_mini_object ((GstMiniObject **) & type); if (scenario) gst_object_unref (scenario); @@ -4150,6 +4149,8 @@ gst_validate_scenario_finalize (GObject * object) g_assert (g_main_context_acquire (g_main_context_default ())); g_main_context_release (g_main_context_default ()); + g_list_free_full (priv->seeks, + (GDestroyNotify) gst_validate_seek_information_free); g_list_free_full (priv->actions, (GDestroyNotify) gst_mini_object_unref); g_list_free_full (priv->interlaced_actions, (GDestroyNotify) gst_mini_object_unref); diff --git a/validate/gst/validate/validate.c b/validate/gst/validate/validate.c index 0405712..d8980ba 100644 --- a/validate/gst/validate/validate.c +++ b/validate/gst/validate/validate.c @@ -151,6 +151,7 @@ get_test_file_meta (void) return NULL; } +/* Takes ownership of @structures */ static GList * get_config_from_structures (GList * structures, GstStructure * local_vars, const gchar * suffix) @@ -169,6 +170,7 @@ get_config_from_structures (GList * structures, GstStructure * local_vars, } gst_structure_foreach (structure, (GstStructureForeachFunc) _set_vars_func, local_vars); + gst_structure_free (structure); } else { gst_validate_structure_resolve_variables (structure, local_vars); result = g_list_append (result, structure); @@ -181,6 +183,7 @@ get_config_from_structures (GList * structures, GstStructure * local_vars, gst_structure_free (structure); } } + g_list_free (structures); return result; } @@ -228,7 +231,6 @@ create_config (const gchar * config, const gchar * suffix) result = get_config_from_structures (structures, local_vars, suffix); loaded_globals = TRUE; - g_list_free (structures); gst_structure_free (local_vars); return result; } @@ -271,6 +273,7 @@ gst_validate_get_testfile_configs (const gchar * suffix) } g_free (filename); + g_free (debug); g_strfreev (config_strs); return get_config_from_structures (res, NULL, suffix); diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 1bc50c5..3bf73cc 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -2561,7 +2561,7 @@ class GstValidateMediaDescriptor(MediaDescriptor): if self._xml_path.endswith(ext): return self._xml_path[:len(self._xml_path) - (len(ext) + 1)] - assert "Not reached" is None + assert "Not reached" == None # noqa @staticmethod def new_from_uri(uri, verbose=False, include_frames=False, is_push=False, is_skipped=False): diff --git a/validate/tools/gst-validate.c b/validate/tools/gst-validate.c index f910353..968af6d 100644 --- a/validate/tools/gst-validate.c +++ b/validate/tools/gst-validate.c @@ -306,7 +306,7 @@ _register_playbin_actions (void) int main (int argc, gchar ** argv); static int -run_test_from_file (const gchar * testfile, gboolean use_fakesinks) +run_test_from_file (gchar * testfile, gboolean use_fakesinks) { gint argc, ret; gchar **args, **argv; @@ -328,8 +328,8 @@ run_test_from_file (const gchar * testfile, gboolean use_fakesinks) g_strfreev (args); g_free (argv); + g_free (testfile); return ret; - } int @@ -427,6 +427,7 @@ main (int argc, gchar ** argv) if (scenario) gst_validate_abort ("Can not specify scenario and testfile at the same time"); + g_option_context_free (ctx); return run_test_from_file (testfile, use_fakesinks); } -- 2.7.4