From 69c9f68573028397a025794c2c5771b1da4c1832 Mon Sep 17 00:00:00 2001 From: xor2003 Date: Fri, 24 Oct 2014 16:01:58 +0400 Subject: Prevent lock --- toxcore/net_crypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toxcore') diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index cfc7d366..ddb0cc92 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -1322,8 +1322,10 @@ static int create_crypto_connection(Net_Crypto *c) ++c->crypto_connections_length; memset(&(c->crypto_connections[id]), 0, sizeof(Crypto_Connection)); - if (pthread_mutex_init(&c->crypto_connections[id].mutex, NULL) != 0) + if (pthread_mutex_init(&c->crypto_connections[id].mutex, NULL) != 0) { + pthread_mutex_unlock(&c->connections_mutex); return -1; + } } pthread_mutex_unlock(&c->connections_mutex); -- cgit v1.2.3