validate: Plug some leaks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/187>
This commit is contained in:
Thibault Saunier 2020-05-04 16:59:54 -04:00
parent bb0d81fd4c
commit af3006dc12
4 changed files with 11 additions and 6 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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):

View file

@ -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);
}