avformat: make avformat_close_input() more tolerant.

The purpose of this commit is to make error management simpler and less
error prone, just like av_free() which is safe with NULL.
This commit is contained in:
Clément Bœsch
2013-09-03 22:22:19 +02:00
parent bc68927a0f
commit 36cd017acd
3 changed files with 12 additions and 3 deletions

View File

@@ -3252,8 +3252,14 @@ void av_close_input_file(AVFormatContext *s)
void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
AVIOContext *pb = s->pb;
AVFormatContext *s;
AVIOContext *pb;
if (!ps || !*ps)
return;
s = *ps;
pb = s->pb;
if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
(s->flags & AVFMT_FLAG_CUSTOM_IO))