From c4af3501052ff8ffe50e4792d2cd5e29f8187ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 9 Aug 2024 11:17:01 +0300 Subject: [PATCH] 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: --- .../validate/gst/validate/gst-validate-scenario.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c index 27fc441f59..89ebb4ed13 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c @@ -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 = "";