summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-03-20 09:13:25 +0100
committerPatrick Steinhardt <ps@pks.im>2017-03-20 12:36:14 +0100
commitdd0b1e8cb643371326991428c7ad8fc9a61a5e1e (patch)
tree2d5d7794756afe019a4472b89047197dc0af0b2f
parent1d50f95546fbebdb5a4c3d7212aa71f33ddfd393 (diff)
downloadlibgit2-dd0b1e8cb643371326991428c7ad8fc9a61a5e1e.tar.gz
openssl_stream: fix releasing OpenSSL locks
The OpenSSL library may require multiple locks to work correctly, where it is the caller's responsibility to initialize and release the locks. While we correctly initialized up to `n` locks, as determined by `CRYPTO_num_locks`, we were repeatedly freeing the same mutex in our shutdown procedure. Fix the issue by freeing locks at the correct index.
-rw-r--r--src/openssl_stream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openssl_stream.c b/src/openssl_stream.c
index bb9b32c67..c0a9c3c37 100644
--- a/src/openssl_stream.c
+++ b/src/openssl_stream.c
@@ -66,7 +66,7 @@ static void shutdown_ssl_locking(void)
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < num_locks; ++i)
- git_mutex_free(openssl_locks);
+ git_mutex_free(&openssl_locks[i]);
git__free(openssl_locks);
}