Commit 19133e96 authored by Justin Ruggles's avatar Justin Ruggles Committed by Anton Khirnov

lavf: fix memleaks in avformat_find_stream_info()

When AVFMT_FLAG_NOBUFFER is set, the packets are not added to the
AVFormatContext packet list, so they need to be freed when they are
no longer needed.
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 2cd7c994
......@@ -2228,6 +2228,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
av_log(ic, AV_LOG_WARNING, "max_analyze_duration %d reached\n",
ic->max_analyze_duration);
if (ic->flags & AVFMT_FLAG_NOBUFFER)
av_packet_unref(pkt);
break;
}
}
......@@ -2256,6 +2258,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
try_decode_frame(st, pkt,
(options && i < orig_nb_streams) ? &options[i] : NULL);
if (ic->flags & AVFMT_FLAG_NOBUFFER)
av_packet_unref(pkt);
st->codec_info_nb_frames++;
count++;
}
......
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