[FFmpeg-devel] [PATCH] Manage the case when the avctx provided to avcodec_close() is NULL.

Stefano Sabatini stefano.sabatini-lala
Sat Dec 4 19:38:47 CET 2010


---
 libavcodec/utils.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 69d333e..4269a53 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -726,6 +726,8 @@ void avsubtitle_free(AVSubtitle *sub)
 
 av_cold int avcodec_close(AVCodecContext *avctx)
 {
+    if (!avctx)
+        return 0;
     /* If there is a user-supplied mutex locking routine, call it. */
     if (ff_lockmgr_cb) {
         if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list