diff mbox series

[FFmpeg-devel] lavu/opt: av_opt_set_array: fix uninitialised return

Message ID D409HPG3DBKO.3QHKAU9N290E1@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lavu/opt: av_opt_set_array: fix uninitialised return | 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. 7, 2024, 6:19 p.m. UTC
In one failure path for av_opt_set_array, the ret variable
was declared again, shadowing the outer one and writing the
return value to the wrong one and then after the goto returning
the uninitialized one instead.

Introduced in 450a3f58edb22d28912a5e65dc08d9e2fb805066

Fixes: CID1619242 Uninitialized scalar variable
---
 libavutil/opt.c | 1 -
 1 file changed, 1 deletion(-)


base-commit: c0666d8bedfb8bd242ea2a9fe2bd3e5a1addc0a5
diff mbox series

Patch

diff --git a/libavutil/opt.c b/libavutil/opt.c
index d2af76478c..81fc1c5994 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -2368,7 +2368,6 @@  int av_opt_set_array(void *obj, const char *name, int search_flags,
               val_type == AV_OPT_TYPE_FLOAT    ||
               val_type == AV_OPT_TYPE_DOUBLE   ||
               val_type == AV_OPT_TYPE_RATIONAL) {
-            int ret;
 
             switch (val_type) {
             case AV_OPT_TYPE_INT:       intnum = *(int*)src;                break;