diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2016-07-23 21:43:06 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-13 13:08:57 +0200 |
commit | 6e6609f5dd61e2b195748b16d46964bd97d77c80 (patch) | |
tree | 4bd363f6cc20a3cbbe1d5403d529bb3da912b759 /libavutil | |
parent | 6e13acaadd5ce44068c090675d0f84dc0d73b152 (diff) | |
download | ffmpeg-6e6609f5dd61e2b195748b16d46964bd97d77c80.tar.gz |
libavutil/opt: Small bugfix in example.
Fix const corectness and zero init the struct. This example code would actually crash when initializing string.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 69630f4d304a4e35d90957d6a170744af87cbf93)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/opt.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h index 753434d628..f6ab2839ed 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -58,7 +58,7 @@ * The following example illustrates an AVOptions-enabled struct: * @code * typedef struct test_struct { - * AVClass *class; + * const AVClass *class; * int int_opt; * char *str_opt; * uint8_t *bin_opt; @@ -96,7 +96,7 @@ * @code * test_struct *alloc_test_struct(void) * { - * test_struct *ret = av_malloc(sizeof(*ret)); + * test_struct *ret = av_mallocz(sizeof(*ret)); * ret->class = &test_class; * av_opt_set_defaults(ret); * return ret; |