[FFmpeg-devel] [PATCH] avcodec/libxevd: Add av_packet_free() to avoid memory leak

Jiasheng Jiang jiashengjiangcool at gmail.com
Sun Aug 3 18:41:43 EEST 2025


Add av_packet_free() to free pkt_au in the error paths.

Fixes: cfe2947887 ("avcodec/evc_decoder: Provided support for EVC decoder")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool at gmail.com>
---
 libavcodec/libxevd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/libxevd.c b/libavcodec/libxevd.c
index 520fdab7d8..87f6eb129c 100644
--- a/libavcodec/libxevd.c
+++ b/libavcodec/libxevd.c
@@ -402,6 +402,7 @@ static int libxevd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
                     return AVERROR_EXTERNAL;
                 } else if (xevd_ret == XEVD_OK_FRM_DELAYED) {
                     if(bs_read_pos == pkt_au->size) {
+                        av_packet_free(&pkt_au);
                         return AVERROR(EAGAIN);
                     }
                 } else { // XEVD_OK
@@ -422,6 +423,7 @@ static int libxevd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
                 }
             }
         }
+        av_packet_free(&pkt_au);
     } else { // decoder draining mode handling
 
         xevd_ret = xevd_pull(xectx->id, &imgb);
-- 
2.25.1



More information about the ffmpeg-devel mailing list