[FFmpeg-cvslog] network: Do not leave context locked on error

Vittorio Giovara git at videolan.org
Sat May 16 00:16:08 CEST 2015


ffmpeg | branch: release/2.6 | Vittorio Giovara <vittorio.giovara at gmail.com> | Wed Apr 22 14:59:55 2015 +0100| [485f53548be4345e336ec2ad538a45e44ec5b65e] | committer: Michael Niedermayer

network: Do not leave context locked on error

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 45340f9fc77e254924f129c764b685fe682e380c)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=485f53548be4345e336ec2ad538a45e44ec5b65e
---

 libavformat/network.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index e9eab29..57a5b41 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -77,8 +77,10 @@ int ff_tls_init(void)
         if (!CRYPTO_get_locking_callback()) {
             int i;
             openssl_mutexes = av_malloc_array(sizeof(pthread_mutex_t), CRYPTO_num_locks());
-            if (!openssl_mutexes)
+            if (!openssl_mutexes) {
+                avpriv_unlock_avformat();
                 return AVERROR(ENOMEM);
+            }
             for (i = 0; i < CRYPTO_num_locks(); i++)
                 pthread_mutex_init(&openssl_mutexes[i], NULL);
             CRYPTO_set_locking_callback(openssl_lock);



More information about the ffmpeg-cvslog mailing list