Message ID | AM7PR03MB6660BF7B8A30743D5F1612948FA69@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | d47a986b7922f610acb6801620aa9b4fa9a2b243 |
Headers | show |
Series | [FFmpeg-devel,1/6] avcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CC | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index e5d09752cb..26a94cd419 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1626,6 +1626,14 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q) av_fifo_generic_read(q->async_fifo, &sync, sizeof(sync), NULL); av_fifo_generic_read(q->async_fifo, &bs, sizeof(bs), NULL); +#if QSV_VERSION_ATLEAST(1, 26) + if (avctx->codec_id == AV_CODEC_ID_H264) { + mfxExtBuffer **enc_buf = bs->ExtParam; + mfxExtAVCEncodedFrameInfo *enc_info = (mfxExtAVCEncodedFrameInfo *)(*bs->ExtParam); + av_freep(&enc_info); + av_freep(&enc_buf); + } +#endif av_freep(&sync); av_freep(&bs); av_packet_unref(&pkt);
Freeing the new H.264 specific fields has been forgotten. (This leak only appears in case the encoder has not been completely drained.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/qsvenc.c | 8 ++++++++ 1 file changed, 8 insertions(+)