1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Lukasz Marek 2014-04-04 19:28:45 +02:00 committed by Michael Niedermayer
parent 506064ed10
commit 3aac5fcfa9

View File

@ -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);