codecs: AV1: Ensure current picture and frame to NULL before return

The current code fails to clear the current picture and frame pointer if
some flow error such as EOS happens. This causes the double free issue in
gst_av1_decoder_reset().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5104>
This commit is contained in:
He Junyan 2023-07-26 16:27:43 +08:00
parent 8846400b83
commit 5aa2239c4b

View file

@ -787,15 +787,16 @@ out:
gst_av1_decoder_drain_output_queue (self,
priv->preferred_output_delay, &output_ret);
priv->current_picture = NULL;
priv->current_frame = NULL;
if (output_ret != GST_FLOW_OK) {
GST_DEBUG_OBJECT (self,
"Output returned %s", gst_flow_get_name (output_ret));
return output_ret;
}
priv->current_picture = NULL;
priv->current_frame = NULL;
if (ret == GST_FLOW_ERROR) {
GST_VIDEO_DECODER_ERROR (decoder, 1, STREAM, DECODE,
("Failed to handle the frame %d", frame->system_frame_number),