Commit 3aac5fcf authored by Lukasz Marek's avatar Lukasz Marek Committed by 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: 's avatarLukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 506064ed
...@@ -1613,9 +1613,11 @@ void av_opt_freep_ranges(AVOptionRanges **rangesp) ...@@ -1613,9 +1613,11 @@ void av_opt_freep_ranges(AVOptionRanges **rangesp)
for (i = 0; i < ranges->nb_ranges * ranges->nb_components; i++) { for (i = 0; i < ranges->nb_ranges * ranges->nb_components; i++) {
AVOptionRange *range = ranges->range[i]; AVOptionRange *range = ranges->range[i];
if (range) {
av_freep(&range->str); av_freep(&range->str);
av_freep(&ranges->range[i]); av_freep(&ranges->range[i]);
} }
}
av_freep(&ranges->range); av_freep(&ranges->range);
av_freep(rangesp); av_freep(rangesp);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment