network: Do not leave context locked on error
authorVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 22 Apr 2015 13:59:55 +0000 (14:59 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 23 Apr 2015 11:42:33 +0000 (13:42 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/network.c

index e9eab29..57a5b41 100644 (file)
@@ -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);