aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Marek <lukasz.m.luki@gmail.com>2014-04-04 19:28:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-10 04:53:00 +0200
commitfc8eb4c1f9847b0a465bab5cfbcc8069e9e6b308 (patch)
tree5c74a8efba2e5aabc58f38aade0eeb9d51b3431a
parent02bae9f013e73f960e9283b79d9ebf4bc81969c6 (diff)
downloadffmpeg-fc8eb4c1f9847b0a465bab5cfbcc8069e9e6b308.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> (cherry picked from commit 3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/opt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 652a2ddbb3..64901f2736 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1599,8 +1599,10 @@ void av_opt_freep_ranges(AVOptionRanges **rangesp)
for (i = 0; i < ranges->nb_ranges; 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);