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>
pull/64/head
Lukasz Marek 11 years ago committed by Michael Niedermayer
parent 506064ed10
commit 3aac5fcfa9
  1. 6
      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);

Loading…
Cancel
Save