Merge commit 'a2041a6522642859ce64af1c618d6fb90a50d4af'
[ffmpeg.git] / libavcodec / qsvenc.c
index 029e8f3..948751d 100644 (file)
@@ -1026,6 +1026,9 @@ static void clear_unused_frames(QSVEncContext *q)
     while (cur) {
         if (cur->used && !cur->surface.Data.Locked) {
             free_encoder_ctrl_payloads(&cur->enc_ctrl);
+            if (cur->frame->format == AV_PIX_FMT_QSV) {
+                av_frame_unref(cur->frame);
+            }
             cur->used = 0;
         }
         cur = cur->next;