From 20ddda25383cabbd565442f9844b741248893dc3 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 14 Apr 2023 09:51:39 -0400 Subject: [PATCH] v4l2: videodec: Ensure object is inactive on failure Sprinkle stop() calls in error case to guaranty that the capture object is inactive on failure. Not doing so could allow some code to be called in unexpected (and possibly undefined) conditions. Part-of: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c index 541fd72..2883605 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c @@ -685,13 +685,16 @@ gst_v4l2_video_dec_setup_capture (GstVideoDecoder * decoder) not_negotiated: GST_ERROR_OBJECT (self, "not negotiated"); gst_v4l2_error (self, &error); + gst_v4l2_object_stop (self->v4l2capture); return GST_FLOW_NOT_NEGOTIATED; activate_failed: GST_ELEMENT_ERROR (self, RESOURCE, SETTINGS, (_("Failed to allocate required memory.")), ("Buffer pool activation failed")); + gst_v4l2_object_stop (self->v4l2capture); return GST_FLOW_ERROR; flushing: + gst_v4l2_object_stop (self->v4l2capture); return GST_FLOW_FLUSHING; } -- 2.7.4