PR #22613 opened by Aleksoid1978
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22613
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22613.patch


>From 0b37590641e6a333a0280e7a1fc1a11f96bf1e81 Mon Sep 17 00:00:00 2001
From: Aleksoid <[email protected]>
Date: Wed, 25 Mar 2026 14:57:37 +1000
Subject: [PATCH] avcodec/vp9: Fixed memory leak when vp9_frame_alloc()
 function fails.

---
 libavcodec/vp9.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 1f34197a28..a07ce120af 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1637,8 +1637,10 @@ static int vp9_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
         vp9_frame_replace(&s->s.frames[REF_FRAME_SEGMAP], src);
     vp9_frame_replace(&s->s.frames[REF_FRAME_MVPAIR], src);
     vp9_frame_unref(&s->s.frames[CUR_FRAME]);
-    if ((ret = vp9_frame_alloc(avctx, &s->s.frames[CUR_FRAME])) < 0)
+    if ((ret = vp9_frame_alloc(avctx, &s->s.frames[CUR_FRAME])) < 0) {
+        ff_cbs_fragment_reset(&s->current_frag);
         return ret;
+    }
 
     s->s.frames[CUR_FRAME].header_ref = av_refstruct_ref(s->header_ref);
     s->s.frames[CUR_FRAME].frame_header = s->frame_header;
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to