From bf640b53db385ae779485ddcbd7bc1734f986efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 25 Jul 2025 18:50:06 +0200 Subject: [PATCH] avcodec/hevc/hevcdec: handle rpu_buf allocation failure correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kacper Michajłow --- 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,