diff options
author | Clément Bœsch <u@pkh.me> | 2013-09-03 22:22:19 +0200 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2013-09-04 22:06:38 +0200 |
commit | 36cd017acd9cac0e6695124c052a59fb1fc13145 (patch) | |
tree | 165e81d51257cb4f25d5f9c03f0b44da537a6df6 /libavformat/utils.c | |
parent | bc68927a0f2c26edc675a01db7ac77ab42a81d0c (diff) | |
download | ffmpeg-36cd017acd9cac0e6695124c052a59fb1fc13145.tar.gz |
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.
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 763588b204..b12d5b8694 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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)) |