[FFmpeg-devel] [PATCH 3/4] lavu/opt: explicity set NULL as dict/binary defaults

Lukasz Marek lukasz.m.luki2 at gmail.com
Sat Nov 8 18:13:52 CET 2014

Unless user clears context manually during creation,
binary and dict pointer may contain random values.

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
 libavutil/opt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 4116f96..0692393 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1224,6 +1224,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
             case AV_OPT_TYPE_BINARY:
             case AV_OPT_TYPE_DICT:
                 /* Cannot set defaults for these types */
+                *(void **)dst = NULL;
                 av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name);

More information about the ffmpeg-devel mailing list