[FFmpeg-cvslog] lavu/opt: validate range before dereference
Lukasz Marek
git at videolan.org
Fri Apr 4 22:26:35 CEST 2014
ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki at gmail.com> | Fri Apr 4 19:28:45 2014 +0200| [3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f] | committer: Michael Niedermayer
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 at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f
---
libavutil/opt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index ea2a5b7..33ebe52 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);
More information about the ffmpeg-cvslog
mailing list