diff --git a/libavutil/opt.c b/libavutil/opt.c index ea2a5b7d48..33ebe52749 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);