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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
This commit is contained in:
Nicolas Dufresne 2023-04-14 09:51:39 -04:00
parent 8e64dea5c6
commit 1ca7f6949e

View file

@ -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;
}