diff options
author | Lukasz Marek <lukasz.m.luki@gmail.com> | 2014-04-04 19:28:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-04 22:09:57 +0200 |
commit | 3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f (patch) | |
tree | 6de9b720b672195f96a7aaf05f6f4a0d1b88ee87 /libavutil | |
parent | 506064ed10f6c0453f3b1fa8819cdc37696816df (diff) | |
download | ffmpeg-3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f.tar.gz |
lavu/opt: validate range before dereference
This change make error handling simplier.
av_opt_freep_ranges may be called when some ranges are NULL,
for example after memory allocation fail.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/opt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index ea2a5b7d48..33ebe52749 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1613,8 +1613,10 @@ void av_opt_freep_ranges(AVOptionRanges **rangesp) for (i = 0; i < ranges->nb_ranges * ranges->nb_components; i++) { AVOptionRange *range = ranges->range[i]; - av_freep(&range->str); - av_freep(&ranges->range[i]); + if (range) { + av_freep(&range->str); + av_freep(&ranges->range[i]); + } } av_freep(&ranges->range); av_freep(rangesp); |