[FFmpeg-cvslog] apv_decode: Fix memory leak on decode error

Mark Thompson git at videolan.org
Mon May 5 19:29:30 EEST 2025


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sat May  3 17:46:29 2025 +0100| [5acd2145a4cd139c0e82f6bf7168574b4c040acf] | committer: Mark Thompson

apv_decode: Fix memory leak on decode error

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5acd2145a4cd139c0e82f6bf7168574b4c040acf
---

 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 = {



More information about the ffmpeg-cvslog mailing list