From b5bb7d7016e99205074fb467aa167038da2f9c18 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 23 Nov 2017 12:27:11 +0100 Subject: [PATCH] validate-scenario: Don't assume element have factories Some elements might not originate from factories (like custom/internal elements). Avoids dereferencing a NULL pointer --- validate/gst/validate/gst-validate-scenario.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 94d74dc9ec..8a792989eb 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -2296,7 +2296,8 @@ _get_target_elements_by_klass_or_factory_name (GstValidateScenario * scenario, if (klass && gst_validate_element_has_klass (pipeline, klass)) result = g_list_prepend (result, gst_object_ref (pipeline)); - if (fname && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (pipeline)), + if (fname && gst_element_get_factory (pipeline) + && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (pipeline)), fname)) result = g_list_prepend (result, gst_object_ref (pipeline)); @@ -2318,7 +2319,7 @@ _get_target_elements_by_klass_or_factory_name (GstValidateScenario * scenario, goto next; } - if (fname + if (fname && gst_element_get_factory (child) && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (child)), fname)) result = g_list_prepend (result, gst_object_ref (child)); @@ -3209,7 +3210,7 @@ should_execute_action (GstElement * element, GstValidateAction * action) tmp = gst_structure_get_string (action->structure, "target-element-factory-name"); - if (tmp != NULL + if (tmp != NULL && gst_element_get_factory (element) && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (element)), tmp)) return TRUE;