From 5acd2145a4cd139c0e82f6bf7168574b4c040acf Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Sat, 3 May 2025 17:46:29 +0100 Subject: [PATCH] apv_decode: Fix memory leak on decode error --- libavcodec/apv_decode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/apv_decode.c b/libavcodec/apv_decode.c index b1c59fc873..1323dee1f8 100644 --- a/libavcodec/apv_decode.c +++ b/libavcodec/apv_decode.c @@ -385,7 +385,7 @@ static int apv_decode_frame(AVCodecContext *avctx, AVFrame *frame, case APV_PBU_PRIMARY_FRAME: err = apv_decode(avctx, frame, pbu->content); if (err < 0) - return err; + goto fail; *got_frame = 1; break; case APV_PBU_METADATA: @@ -419,9 +419,10 @@ static int apv_decode_frame(AVCodecContext *avctx, AVFrame *frame, } } + err = packet->size; +fail: ff_cbs_fragment_reset(au); - - return packet->size; + return err; } const FFCodec ff_apv_decoder = {