diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index b6fead0b84..b83b0fcda8 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -306,8 +306,10 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, do { ret = get_surface(avctx, q, &insurf); - if (ret < 0) + if (ret < 0) { + av_freep(&sync); return ret; + } ret = MFXVideoDECODE_DecodeFrameAsync(q->session, avpkt->size ? &bs : NULL, insurf, &outsurf, sync);