[FFmpeg-devel] [PATCH] lavc/vvc: Fix unchecked return code and shadowing

Frank Plowman post at frankplowman.com
Sat May 31 23:58:53 EEST 2025


Signed-off-by: Frank Plowman <post at frankplowman.com>
---
 libavcodec/vvc/dec.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index deb1b07b23..ac3f453440 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -1160,7 +1160,7 @@ fail:
 static int frame_end(VVCContext *s, VVCFrameContext *fc)
 {
     const AVFilmGrainParams *fgp;
-    int ret = 0;
+    int ret;
 
     if (fc->ref->needs_fg) {
         av_assert0(fc->ref->frame_grain->buf[0]);
@@ -1172,9 +1172,13 @@ static int frame_end(VVCContext *s, VVCFrameContext *fc)
         case AV_FILM_GRAIN_PARAMS_H274:
             ret = ff_h274_apply_film_grain(fc->ref->frame_grain, fc->ref->frame,
                 &s->h274db, fgp);
+            if (ret < 0)
+                return ret;
             break;
         case AV_FILM_GRAIN_PARAMS_AV1:
             ret = ff_aom_apply_film_grain(fc->ref->frame_grain, fc->ref->frame, fgp);
+            if (ret < 0)
+                return ret;
             break;
         }
     }
@@ -1182,7 +1186,7 @@ static int frame_end(VVCContext *s, VVCFrameContext *fc)
     if (!s->avctx->hwaccel && s->avctx->err_recognition & AV_EF_CRCCHECK) {
         VVCSEI *sei = &fc->sei;
         if (sei->picture_hash.present) {
-            int ret = ff_h274_hash_init(&s->hash_ctx, sei->picture_hash.hash_type);
+            ret = ff_h274_hash_init(&s->hash_ctx, sei->picture_hash.hash_type);
             if (ret < 0)
                 return ret;
 
-- 
2.47.0



More information about the ffmpeg-devel mailing list