From 518d192dc5035b765b0eed793d45ebac36a7a065 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 5 May 2020 17:30:48 +0200 Subject: [PATCH] deinterlace: Don't leak frame in error case CID #1455494 Part-of: --- gst/deinterlace/gstdeinterlace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 9dc5c966d7..b258440b23 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -1082,8 +1082,12 @@ gst_deinterlace_push_history (GstDeinterlace * self, GstBuffer * buffer) onefield = GST_VIDEO_FRAME_IS_ONEFIELD (frame); fields_to_push = (onefield) ? 1 : 2; - g_return_if_fail (self->history_count < - GST_DEINTERLACE_MAX_FIELD_HISTORY - fields_to_push); + if (G_UNLIKELY (self->history_count >= + GST_DEINTERLACE_MAX_FIELD_HISTORY - fields_to_push)) { + GST_WARNING_OBJECT (self, "history count exceeded limit"); + gst_video_frame_unmap_and_free (frame); + return; + } gst_deinterlace_get_buffer_state (self, frame, &buf_state, &interlacing_mode);