validate: Fix memory leaks

Various structures were being leaked.
This commit is contained in:
Edward Hervey 2019-11-20 10:19:00 +01:00 committed by Edward Hervey
parent 80de180cc7
commit 4f0bfcc7bb
3 changed files with 12 additions and 8 deletions

View file

@ -137,7 +137,7 @@ _set_vars_func (GQuark field_id, const GValue * value, GstStructure * vars)
static GList *
create_config (const gchar * config, const gchar * suffix)
{
GstStructure *local_vars = gst_structure_new_empty ("vars");
GstStructure *local_vars;
GList *structures = NULL, *tmp, *result = NULL;
gchar *config_file = NULL;
@ -146,6 +146,7 @@ create_config (const gchar * config, const gchar * suffix)
return NULL;
}
local_vars = gst_structure_new_empty ("vars");
structures =
gst_validate_utils_structs_parse_from_filename (config, &config_file);
if (!structures) {

View file

@ -135,6 +135,7 @@ validate_flow_format_caps (const GstCaps * caps,
(gpointer) keys_to_print);
structure_str = gst_structure_to_string (structure);
g_array_append_val (structures_strv, structure_str);
gst_structure_free (structure);
}
caps_str = g_strjoinv (" ", (gchar **) structures_strv->data);

View file

@ -12,21 +12,23 @@ GST_START_TEST (test_expression_parser)
g_object_new (GST_TYPE_VALIDATE_SCENARIO, "validate-runner",
runner, NULL);
GstValidateAction *action;
GstStructure *st;
fail_unless (seek_type);
action = gst_validate_action_new (scenario, set_vars,
gst_structure_from_string
st = gst_structure_from_string
("set-vars, a=(string)\"50\", b=(string)\"70\", default_flags=flush",
NULL), FALSE);
NULL);
action = gst_validate_action_new (scenario, set_vars, st, FALSE);
fail_unless_equals_int (gst_validate_execute_action (set_vars, action),
GST_VALIDATE_EXECUTE_ACTION_OK);
gst_structure_free (st);
gst_validate_action_unref (action);
action = gst_validate_action_new (scenario, seek_type,
gst_structure_from_string
("seek, start=\"min($(a), $(b))\", flags=\"$(default_flags)\"", NULL),
FALSE);
st = gst_structure_from_string
("seek, start=\"min($(a), $(b))\", flags=\"$(default_flags)\"", NULL);
action = gst_validate_action_new (scenario, seek_type, st, FALSE);
gst_structure_free (st);
fail_unless (action);
fail_unless (seek_type->prepare (action));