[FFmpeg-devel] [PATCH 2/2] avcodec: make avcodec_close() more tolerant.

Clément Bœsch u at pkh.me
Tue Sep 3 22:32:49 CEST 2013


See previous commit.
---
 doc/APIchanges       | 3 +++
 libavcodec/utils.c   | 5 +++++
 libavcodec/version.h | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 12b9af4..45965e9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2012-10-22
 
 API changes, most recent first:
 
+2013-xx-xx - xxxxxxx - lavc 55.31.101 - avcodec.h
+  avcodec_close() argument can be NULL.
+
 2013-xx-xx - xxxxxxx - lavf 55.16.101 - avformat.h
   avformat_close_input() argument can be NULL and point on NULL.
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4e510e6..2be0eb5 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2402,6 +2402,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
     if (ret < 0)
         return ret;
 
+    if (!avctx) {
+        ff_unlock_avcodec();
+        return 0;
+    }
+
     if (avcodec_is_open(avctx)) {
         FramePool *pool = avctx->internal->pool;
         int i;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e65c021..f16db2a 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 55
 #define LIBAVCODEC_VERSION_MINOR  31
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
-- 
1.8.4



More information about the ffmpeg-devel mailing list