[FFmpeg-devel] [PATCH 2/6] apv_decode: Fix memory leak on decode error
Mark Thompson
sw at jkqxz.net
Sat May 3 20:55:18 EEST 2025
---
libavcodec/apv_decode.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/apv_decode.c b/libavcodec/apv_decode.c
index b1e1db7d64..2a59c9b25d 100644
--- a/libavcodec/apv_decode.c
+++ b/libavcodec/apv_decode.c
@@ -377,7 +377,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:
@@ -412,8 +412,11 @@ static int apv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
ff_cbs_fragment_reset(au);
-
return packet->size;
+
+fail:
+ ff_cbs_fragment_reset(au);
+ return err;
}
const FFCodec ff_apv_decoder = {
--
2.47.2
More information about the ffmpeg-devel
mailing list