validate: Copy action structure before retrieving strings from it

The returned strings are only valid for as long as the structure is valid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7334>
This commit is contained in:
Sebastian Dröge 2024-08-09 11:17:01 +03:00 committed by Backport Bot
parent b8d7cdbd1f
commit c4af350105

View file

@ -2903,6 +2903,7 @@ _fill_action (GstValidateScenario * scenario, GstValidateAction * action,
GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_NONE;
gboolean optional, needs_parsing = FALSE;
structure = gst_structure_copy (structure);
action->type = gst_structure_get_name (structure);
action_type = _find_action_type (action->type);
@ -2910,6 +2911,7 @@ _fill_action (GstValidateScenario * scenario, GstValidateAction * action,
GST_ERROR_OBJECT (scenario, "Action type %s no found",
gst_structure_get_name (structure));
gst_structure_free (structure);
return GST_VALIDATE_EXECUTE_ACTION_ERROR;
}
@ -2935,7 +2937,7 @@ _fill_action (GstValidateScenario * scenario, GstValidateAction * action,
"No timeout time for action %" GST_PTR_FORMAT, structure);
}
action->structure = gst_structure_copy (structure);
action->structure = structure;
if (!(action->name = gst_structure_get_string (action->structure, "name")))
action->name = "";