[FFmpeg-devel] [PATCH 1/2] Force mutex to NULL after destruction.

Manfred Georg mgeorg at google.com
Wed Oct 1 00:20:42 CEST 2014


A badly behaving user provided mutex manager (such as that in OpenCV) may not reset the mutex to NULL on destruction.  This can cause a problem for a later mutex manager (which may assert that the mutex is NULL before creating).
---
 libavcodec/utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9eb2b5b..778bdc6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3461,6 +3461,8 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
             return -1;
         if (lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY))
             return -1;
+        codec_mutex = NULL;
+        avformat_mutex = NULL;
     }
 
     lockmgr_cb = cb;
-- 
2.1.0.rc2.206.gedb03e5



More information about the ffmpeg-devel mailing list