[FFmpeg-cvslog] avcodec/hevc/hevcdec: handle rpu_buf allocation failure correctly

Kacper Michajłow git at videolan.org
Sun Jul 27 15:09:59 EEST 2025


ffmpeg | branch: master | Kacper Michajłow <kasper93 at gmail.com> | Fri Jul 25 18:50:06 2025 +0200| [bf640b53db385ae779485ddcbd7bc1734f986efb] | committer: Niklas Haas

avcodec/hevc/hevcdec: handle rpu_buf allocation failure correctly

Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>

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

 libavcodec/hevc/hevcdec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 21ecf063c5..c2897ee336 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3747,8 +3747,10 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
         }
 
         s->rpu_buf = av_buffer_alloc(nal->raw_size - 2);
-        if (!s->rpu_buf)
-            return AVERROR(ENOMEM);
+        if (!s->rpu_buf) {
+            ret = AVERROR(ENOMEM);
+            goto fail;
+        }
         memcpy(s->rpu_buf->data, nal->raw_data + 2, nal->raw_size - 2);
 
         ret = ff_dovi_rpu_parse(&s->dovi_ctx, nal->data + 2, nal->size - 2,



More information about the ffmpeg-cvslog mailing list