diff mbox series

[FFmpeg-devel] lavfi/af_channelmap: fix channelmap_init error handling

Message ID D43OW0JHCV5K.Q4KXV2F8IBK3@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lavfi/af_channelmap: fix channelmap_init error handling | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Sept. 11, 2024, 7:07 p.m. UTC
The channelmap_init function was returning success even on error after
7dc81d33c241b9e176ea85956e8317f29bc9e3c0 due to shadowing of the
outer ret variable.

Fixes CID1619297 Logically dead code
---
 libavfilter/af_channelmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: a15d2fdfd96c0ce711e0be3fe6c2f47b5a39b931

Comments

Anton Khirnov Sept. 13, 2024, 10:25 a.m. UTC | #1
Quoting Marvin Scholz (2024-09-11 21:07:29)
> The channelmap_init function was returning success even on error after
> 7dc81d33c241b9e176ea85956e8317f29bc9e3c0 due to shadowing of the
> outer ret variable.
> 
> Fixes CID1619297 Logically dead code
> ---
>  libavfilter/af_channelmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks good.

Thanks,
diff mbox series

Patch

diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index f5209a10cd..7a99ac7780 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -316,7 +316,7 @@  static av_cold int channelmap_init(AVFilterContext *ctx)
     presence_map = av_calloc(s->nch, sizeof(*presence_map));
     for (i = 0; i < s->nch; i++) {
         const int out_idx = s->map[i].out_channel_idx;
-        int ret = check_idx_and_id(ctx, out_idx, s->map[i].out_channel, &s->output_layout, "out");
+        ret = check_idx_and_id(ctx, out_idx, s->map[i].out_channel, &s->output_layout, "out");
         if (ret < 0)
             break;
         if (presence_map[out_idx]) {