gstreamer: Avoid dangling pointers in free_pipeline

Although currently after free_pipeline we free the entire structure
the name and the function suggests that we only free the pipeline.
Also this is fixing a future possible problem with the series
from Vivek Kasireddy reusing the SpiceGstDecoder for another
pipeline if H/W encoder pipeline creation fails.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
This commit is contained in:
Frediano Ziglio 2023-10-31 11:10:01 +00:00
parent fa9922f39a
commit e2bcf5727b

View File

@ -353,11 +353,14 @@ static void free_pipeline(SpiceGstDecoder *decoder)
gst_element_set_state(decoder->pipeline, GST_STATE_NULL);
gst_object_unref(decoder->appsrc);
decoder->appsrc = NULL;
if (decoder->appsink) {
gst_object_unref(decoder->appsink);
decoder->appsink = NULL;
}
gst_object_unref(decoder->pipeline);
gst_object_unref(decoder->clock);
decoder->clock = NULL;
gst_object_unref(decoder->pipeline);
decoder->pipeline = NULL;
}