aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-04-20 17:10:27 +0200
committerPaul B Mahol <onemda@gmail.com>2023-04-20 17:13:45 +0200
commit0dceda12e7c3d10865e1167407878381efa5a138 (patch)
tree095be9c47915f7ce3cf10f1f94b28f6529de5a98
parentdc2da568cfd281740102032582ca25bbf4449100 (diff)
downloadffmpeg-0dceda12e7c3d10865e1167407878381efa5a138.tar.gz
avcodec/pdvdec: fix leaks on init failure and when seeking
-rw-r--r--libavcodec/pdvdec.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/pdvdec.c b/libavcodec/pdvdec.c
index 690a298e16..d1a3d1d3f9 100644
--- a/libavcodec/pdvdec.c
+++ b/libavcodec/pdvdec.c
@@ -113,6 +113,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return avpkt->size;
}
+static void decode_flush(AVCodecContext *avctx)
+{
+ PDVContext *s = avctx->priv_data;
+
+ av_frame_unref(s->previous_frame);
+}
+
const FFCodec ff_pdv_decoder = {
.p.name = "pdv",
CODEC_LONG_NAME("PDV (PlayDate Video)"),
@@ -120,8 +127,10 @@ const FFCodec ff_pdv_decoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_PDV,
.p.capabilities = AV_CODEC_CAP_DR1,
- .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
+ .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |
+ FF_CODEC_CAP_INIT_CLEANUP,
.init = decode_init,
.close = decode_end,
+ .flush = decode_flush,
FF_CODEC_DECODE_CB(decode_frame),
};