History

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.

Clément Bœsch committed 13 years ago

Commit 36cd0171 parent bc689273 files · +12 −3Browse files

Unified · Split

3 files
  1. doc/APIchanges +3 −0
  2. libavformat/utils.c +8 −2
  3. libavformat/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2013-xx-xx - xxxxxxx - lavf 55.16.101 - avformat.h
19+ avformat_close_input() argument can be NULL and point on NULL.
20+
1821 2013-08-29 - e31db62 - lavf 55.15.100 - avformat.h
1922 Add av_format_get_probe_score().
2023
libavformat/utils.c+8−2
@@ -3252,8 +3252,14 @@ void av_close_input_file(AVFormatContext *s) · 3251 unmodified lines
32523252
32533253 void avformat_close_input(AVFormatContext **ps)
32543254 {
3255− AVFormatContext *s = *ps;
3256− AVIOContext *pb = s->pb;
3255+ AVFormatContext *s;
3256+ AVIOContext *pb;
3257+
3258+ if (!ps || !*ps)
3259+ return;
3260+
3261+ s = *ps;
3262+ pb = s->pb;
32573263
32583264 if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
32593265 (s->flags & AVFMT_FLAG_CUSTOM_IO))
libavformat/version.h+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131
3232 #define LIBAVFORMAT_VERSION_MAJOR 55
3333 #define LIBAVFORMAT_VERSION_MINOR 16
34−#define LIBAVFORMAT_VERSION_MICRO 100
34+#define LIBAVFORMAT_VERSION_MICRO 101
3535
3636 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
3737 LIBAVFORMAT_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t