summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <freddy77@gmail.com>2023-10-31 11:10:01 +0000
committerFrediano Ziglio <freddy77@gmail.com>2023-11-03 08:31:06 +0000
commite2bcf5727bfda3dbe3dbaf2f71ee4f4970af4f57 (patch)
tree69e78d988ef22b12a8e3508022dedc3d7479e74f
parentfa9922f39ad82a6020818cc8fa75ac69fb62fb54 (diff)
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>
-rw-r--r--src/channel-display-gst.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 5c9927b..923c7c4 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -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;
}